Skip to main content

make_engine

Function make_engine 

Source
pub fn make_engine() -> Result<Engine, String>
Expand description

Build a wasmtime Engine configured the same way the shell does at startup. Used in two places:

  1. precompile() callers — the produced cwasm must match the host’s engine flags exactly so it deserializes without re-precompilation.
  2. metadata_extract — runs each plugin’s metadata() once behind a one-shot watchdog (1-tick deadline + 5-second detached epoch bump) to time-bound malformed components.

epoch_interruption is ON to match the host (src/plugin/mod.rs), which uses it to bound the wall-clock time of pre_prompt hooks. All three sites share these flags so cwasm artefacts are universally loadable. Per-call timeout semantics differ between sites (host = per-invocation deadline, metadata = one-shot watchdog), but the engine config itself is shared.