Skip to main content

Module context

Module context 

Source
Expand description

The query binding (spec/surface/README.md §1): a DataContext over the store, so the oqx in-memory engine reproduces the whole OQX surface — roots, intrinsics, reach-through, structural relations, the edge graph, the row functions — without a bespoke compiler. Port of packages/core/src/oqx-js/context.ts.

Rows are the store’s raw column objects (blobs as hex) carrying a hidden tag column (TAG_KEY) naming their target; get routes field / intrinsic / relation resolution per target, lazily querying the store. Row functions (text, under, …) arrive as methods on the $self receiver (see the runner’s AST rewrite), since a free function sees no row.

Two seams differ from the reference and are bridged here:

  • DataContext::get has no error channel, so a failure inside a property read (the reserved-basename guard, a SQL error) is stashed in the context and surfaced by the runner after the run; the read itself yields Undefined.
  • the Rust engine expands entries(x) in row position itself (never via call_function), so the frontmatter / inline source handles are materialized eagerly as plain objects — one key per top-level property in key order, valued by the scalar-vs-list rule — instead of the reference’s lazy handle. frontmatter.<k> and entries(frontmatter) read the same values either way.

Structs§

SemanticVec
A query phrase’s embedding: the model whose cache to read and the vector as a float32 little-endian blob.
StoreContext
The store-backed context for one repo.

Enums§

Target
The four scan targets.

Constants§

TAG_KEY
The hidden column tagging a store row with its target.

Functions§

glob_to_like
A * glob as a LIKE pattern with ESCAPE '\'; escape_backslash also escapes \ (the list surfaces do, within does not).
strip_tags
Strip the hidden tag from a value tree (the wire form never carries it).
target_of
The tag of a store row, if it is one.