#[unsafe(no_mangle)]pub unsafe extern "C" fn plg_rt_run_query(
qptr: *const u8,
qlen: u32,
limit: u32,
step_limit: u64,
depth_limit: u32,
) -> u64Expand description
Run one query (UTF-8 at qptr..qptr+qlen) and return packed
(len << 32) | ptr of a JSON byte buffer the host reads then frees via
plg_rt_free. The packed return assumes wasm32 (the pointer fits in the
low 32 bits); wasm64 would need a wider/two-value result (WASM.md finding #7).
Per-request limits bound the query before the platform’s CPU/wall limit does (WASM.md finding #5). All three mirror the CLI’s knobs:
limit: max solutions;0= unbounded.step_limit: step ceiling (PLG_MAX_STEPS);0= keep the module default.depth_limit: metacall depth bound (PLG_METACALL_DEPTH);0= keep the default. Depth matters more on wasm: its ~1 MB stack is far smaller than native’s ~8 MB.
§Safety
Requires plg_init to have run first; qptr/qlen a valid buffer. See the
module’s single-in-flight concurrency contract.