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§
- run_job
- Drive one job to completion.