Concepts
Extensions
The two extension tiers of ysearch - yexpr, a small deterministic expression language, and WASM apps on the Component Model against ysearch-defined WIT worlds.
ysearch has two extension tiers, each matched to where it runs.
| Tier | What it is | Where it runs | Deterministic |
|---|---|---|---|
| yexpr | a small, typed, pure expression language | queries, index pipelines, the matching read path | always |
| WASM apps | any language compiled to a WebAssembly component implementing a ysearch WIT world | kv nodes, indexers, matchers, job workers |
per world |
There is no Lua. marekvs's Lua write scripts become write-script apps,
which keep marekvs's effects-replication model. There is no EVAL,
EVALSHA, or SCRIPT LOAD.
yexpr compiles to closures with the same no-fused-multiply-add rule as the
scorer, so its results are bit-identical on amd64 and arm64. It covers script
scores, runtime fields, sort keys, filters, bucket scripts, ingest conditions,
and campaign score adjustments. Stored expressions are registered with
SCRIPT.PUT.
An app is a WebAssembly component that implements one of ysearch's WIT worlds:
| World | What it does |
|---|---|
write-script |
an atomic document update on a kv node; its effects replicate, not its execution |
pipeline-processor |
a custom step in a write or index pipeline |
transform-job |
by-query updates, reindex transforms, and backfills |
matcher |
a custom matcher that emits integer features for a campaign |
analysis |
a custom tokenizer or token filter |
The host is wippyai/wasm-runtime, which adds the Component Model on top of
wazero. It is pinned, vendored, and hardened, and a conformance suite and
decoder fuzzing land before anything depends on it.
- Guest code never produces a score. A
matcherapp emits integer features; the host computes the score from them with fixed weights, in a fixed order. - Deterministic worlds are float-free. A component with any f32 or f64 instruction is rejected at registration for a deterministic world, and so is one with SIMD or thread instructions.
- Deterministic fuel. CPU limits count instructions, so an app runs out of fuel at the same instruction on every architecture.
- Content-addressed. Apps are registered in the KV plane by sha256 and
stored under
apps/<sha256>.wasm. A referenced app is a garbage-collection root, and deleting it is refused while a reference exists.
Embedding and classification models that need Python or CUDA run as services outside the repository, reached over gRPC. ysearch itself stays Go only.