Skip to main content

Module runner

Module runner 

Source
Expand description

The reactor loop: the host drives the guest, one command at a time.

This module is the shape of the whole system. The guest never calls the host and waits — it returns a Command, the host carries it out, and the host steps the guest again with the resulting Event. Two things follow from that inversion, and both are why it is worth the awkwardness:

  • Cancellation needs no guest cooperation. The host simply stops stepping. A guest cannot ignore, delay, or trap its way out of it.
  • Every iteration is observable. Progress, token counts, and capability decisions all pass through the host, even for a block whose internal loop the DAG cannot see.

The alternative — host functions the guest imports and blocks on — is not merely less tidy, it does not work: a single-threaded core-wasm guest offers no execution context for the host to call back into, and the wasmtime Store is !Sync while inference must run on a separate thread.

Structs§

JobSpec
Everything needed to run one job.

Enums§

Abi
Pointer width of a guest module, read from the module rather than assumed.
JobEvent
Something worth telling a watcher about while a job runs.

Functions§

alternate_models_of
Every model a spec can reach besides its own — the reroute targets and the model-bearing Judges, deduplicated.
read_signature
Read a block’s declared signature out of a compiled module.
run_job
Drive one job to completion.

Type Aliases§

Alternates
Backends for models other than the job’s own, keyed by the model that names them.