Expand description
I/O-free query core: parse + solve + the v1 JSON wire shape, with no
commitment to where the bytes go. Both the WASI/CLI shell (entry.rs,
sink = stdout) and the Tier-2 reactor (reactor.rs, sink = a linear-memory
buffer) call into here, so the JSON shape and the exhausted rule have a
single source and can’t drift between the two transports
(docs/design/done/WASM_TIER2_PLAN.md A1 / WASM.md finding #6). The shared core
INVOCATION.md’s resident mode also wants is the same one.
Enums§
- Query
Result - Outcome of running one query, with the prefixed message the v1 contract
puts on the wire for the two failure classes. The caller maps these to its
own surface — exit codes 2/3 for the CLI, an
{"error":...}object for the reactor — but the message bytes are produced once, here.
Functions§
- exhausted
- The v1
exhaustedflag: the search ran to completion unless a--limitstopped it exactly at the cap. Single-sourced so the CLI and the reactor compute it identically (finding #4 — the spike hard-codedtrue). - run_
query - Parse
qagainst the program inm, then solve it. The caller must have already reset per-query state and set the per-query limits; this consumesm.erroron the error path so the message can be returned. - write_
error_ json - v1 error object:
{"error":"<escaped message>"}. No trailing newline — the CLI appends one for stdout, the reactor returns the bytes as-is. - write_
solutions_ json - v1 success object:
{"count":N,"exhausted":B,"solutions":[…]}, keys in serde_json sorted order.output, whenSome, inserts an"output"field (sorts betweenexhaustedandsolutions) carrying capturedwrite/1bytes — the reactor uses it (no stdout in an isolate, D4); the CLI passesNonebecause its output already streamed to stdout, keeping native bytes byte-identical to v1.