open-standards/wai/wai-quantum/src/engine/mod.rs
Transaction Science 7acd4e223a wai-quantum engine in a page: one job function for every host, and the engine in the browser
- engine::job: a job planned, run, sealed with the host's key and returned
  in the service's form (run), its check (verify), a key's did:key (did_of)
  and a program's lint. The command line now calls these; the browser
  binding calls the same.
- engine::draw: the circuit drawer, moved from the command line.
- The engine runs on wasm32-unknown-unknown: a result there carries no
  elapsed_ms (a tab has no clock std reads), and the cut-rank order search
  runs its seeds in turn where there are no threads, finding the same orders.
- A program that measures in the middle on the state vector is admitted
  with the job's memory margin counted once, as trajectories count it, not
  once per state: two 256 MiB margins had left no room in 512 MiB, and the
  service refused a qubit it could hold.
- wai-web, feature quantum_engine (off by default, for the IDE's bundle):
  QuantumEngine (run, plan, methods, signer_did) signing with the page's
  key, and engine_lint, engine_draw and engine_verify. Tested natively and
  in wasm32 under Node, where a job runs and verifies, a changed result is
  refused, and every method a tab holds runs; wai-web-wasm.yml runs both
  with their counts.
- wai-rs: feature quantum_engine re-exports the engine as wai::engine.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit aa516abdb1)
2026-10-20 17:34:16 -04:00

33 lines
1.5 KiB
Rust

//! The job service's engine: a program and what is asked of it, planned onto a
//! method, run, and answered as JSON. The service, the command line and the
//! desktop app plan and run a job the same way, so the same job gives the same
//! result on each.
//!
//! - [`catalog`]: a job read and checked ([`catalog::Request`]), the methods
//! and their limits, and [`catalog::plan`], which picks a method for a job
//! and says why, with the memory and work it will take.
//! - [`run`]: [`run::run`] carries a plan out and gives the result: counts,
//! expectation values, amplitudes, the accuracy class and what the method
//! did.
//! - [`dynamic`]: programs that measure in the middle, reset or branch on a
//! measured bit, run branch by branch.
//! - [`receipt`] (with `quantum_receipt`): a result sealed with a key over
//! the request and the result in their canonical JSON, and checked. The
//! service seals with its key and the command line with the user's, in one
//! form.
//! - [`job`] (with `quantum_receipt`): a job end to end, planned, run and
//! sealed, in the service's form; its check; and a program's lint.
//! - [`draw`]: a program's circuit as text.
//!
//! Requests and results are the service's JSON (`/v1/openapi.json` there).
//! Keys, metering a job's energy, queueing and limits per client stay with
//! whatever hosts the engine.
pub mod catalog;
pub mod draw;
pub mod dynamic;
#[cfg(feature = "quantum_receipt")]
pub mod job;
#[cfg(feature = "quantum_receipt")]
pub mod receipt;
pub mod run;