Skip to main content

Crate nibli_session

Crate nibli_session 

Source
Expand description

The shared session core — the ONE compile/assert/query chain every runtime surface wraps with only boundary conversion.

Before this crate, the compile chain (nibli_kr::parse_checkednibli_semantics::compile_from_astnibli_reason::transform_compute_nodes) plus the compute-predicate registry and the assert/query wrappers were hand-mirrored across nibli-engine (native), nibli-pipeline (WASM component), nibli-wasm (wasm-bindgen), nibli-ui (Dioxus), and nibli-verify’s battery — the pipeline’s copy literally commented “the mirror of nibli-engine’s compile_text, so native and WASM agree”. CoreSession is that agreement BY CONSTRUCTION.

What stays surface-side, deliberately:

  • the ERROR BOUNDARY (this crate speaks canonical NibliError; the pipeline converts to its WIT twin, nibli-wasm flattens to String);
  • verdict/proof SERIALIZATION (WIT records, JSON, rendered text);
  • the LINT policy (nibli_kr::lint — stdout [Note:] echoes vs UI note data vs none) and env reads (NIBLI_QUIET/NIBLI_STRICT are wasip2/host concerns; the browser has no process env);
  • STORE write-through (nibli-engine’s durable registry mints its own ids and reaches the KB through CoreSession::kb);
  • compute-dispatch WIRING (the pipeline bridges to its WIT host import, the engine offers an opt-in TCP client, the browser leaves external compute unregistered) — the CoreSession::set_compute_dispatch passthrough is the seam.

nibli-formalize’s gates intentionally do NOT use this crate: they stop before compute-marking (the translator never needs ComputeNodes), keep the AST for the render round-trip gate, and carry their own GateError taxonomy (see nibli-formalize/src/gates.rs).

Structs§

CoreSession
The shared session: a nibli_reason::KnowledgeBase + the compute-predicate registry, with the compile/assert/query verbs every surface previously hand-mirrored. No env reads, no linting, no persistence — those are per-surface boundary policy (see the module doc).

Functions§

compile_text
THE compile chain: parse + semantic compile + compute-marking against the given predicate set. Free-fn form for per-call-set users (nibli-ui builds its set fresh each query); CoreSession::compile_text is the session-owned form.
compile_unmarked
Compile KR text WITHOUT compute-marking: parse + semantic compile only. For consumers that deliberately stop before transform_compute_nodes (display paths; nibli-formalize’s gates mirror this shape independently).