| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
All checks were successful
wai-quantum command line / does this change touch it (push) Successful in 36s
wai-quantum editors / does this change touch it (push) Successful in 38s
wai-quantum for JavaScript / does this change touch it (push) Successful in 34s
wai-quantum resource estimation / does this change touch it (push) Successful in 30s
wai-quantum contract / does this change touch it (push) Successful in 56s
wai-quantum OpenQASM reader / does this change touch it (push) Successful in 50s
wai-quantum docs, course and locales / does this change touch it (push) Successful in 1m17s
wai-quantum pulse and dynamics / does this change touch it (push) Successful in 31s
wai-quantum error correction and mitigation / does this change touch it (push) Successful in 22s
wai-quantum other formats / does this change touch it (push) Successful in 1m7s
wai-quantum for Python / does this change touch it (push) Successful in 1m3s
wai-quantum qudit jobs / does this change touch it (push) Successful in 20s
wai-audit collector and player integration / does this change touch it (push) Successful in 1m33s
WAI operation catalogue / does this change touch it (push) Successful in 1m31s
wai-quantum service / does this change touch it (push) Successful in 19s
wai-quantum variational and algorithm library / does this change touch it (push) Successful in 22s
wai-quantum views in agent hosts / does this change touch it (push) Successful in 26s
wai-sink-android native sink library / does this change touch it (push) Successful in 23s
wai-quantum extension points / does this change touch it (push) Successful in 50s
wai-quantum studio and desktop / does this change touch it (push) Successful in 43s
WAI Studio / does this change touch it (push) Successful in 32s
wai-quantum verdicts and repairs / does this change touch it (push) Successful in 44s
wai-sink-swift native sink package / does this change touch it (push) Successful in 42s
wai-quantum pulse and dynamics / the same bits · linux-arm64 (push) Successful in 2m35s
wai-quantum service / service energy · linux packages (push) Successful in 2m43s
wai-quantum variational and algorithm library / parameters, gradients, optimisers, VQE, QAOA and builders · linux-arm64, release (push) Successful in 3m31s
repository checks / lockfiles, advisories, tests in CI, workflow hygiene, spec and section references, public text (push) Successful in 6m1s
wai-sink-android native sink library / the JNI layer and the platform-free half on the host JVM · linux-arm64 (push) Successful in 4m33s
wai-quantum extension points / the registry and the example · linux-arm64 (push) Successful in 5m25s
WAI breaking changes and the conformance runner / WAI breaking · does this change touch WAI (push) Successful in 8s
wai-quantum energy-landscape jobs / does this change touch it (push) Successful in 9s
wai-quantum wasmQ / does this change touch it (push) Successful in 8s
wai-quantum contract / the policy is linked, and the deprecations page reads (push) Successful in 7s
wai-quantum editors / editors · linux (push) Successful in 3m49s
wai-quantum OpenQASM reader / corpus under wasm32-wasip2 (wasmtime) (push) Successful in 1m48s
wai-quantum docs, course and locales / the Studio's words in every locale · linux (push) Successful in 17s
wai-quantum for JavaScript / javascript · linux (push) Successful in 4m32s
wai-quantum contract / API compatibility · linux (push) Successful in 5m9s
wai-quantum docs, course and locales / the course and the command line's languages · linux (push) Successful in 3m35s
wai-quantum OpenQASM reader / reader and corpus · linux (push) Successful in 5m8s
wai-quantum pulse and dynamics / reader, simulator and pulse jobs · linux, release (push) Successful in 1m51s
wai-quantum resource estimation / estimation and calibration · linux, release (push) Successful in 7m26s
wai-quantum other formats / the set under wasm32-wasip2 (wasmtime) (push) Successful in 3m16s
wai-quantum pulse and dynamics / reader, simulator and pulse jobs under wasm32-wasip2 (wasmtime) (push) Successful in 1m16s
wai-quantum other formats / readers, writers and the set · linux (push) Successful in 4m32s
wai-quantum qudit jobs / the module and the conformance set under wasm32-wasip2 (wasmtime) (push) Successful in 1m12s
wai-audit collector and player integration / collector · linux (push) Successful in 2m54s
wai-quantum error correction and mitigation / codes, decoders, texts and mitigation · linux, release (push) Successful in 6m53s
wai-quantum extension points / the registry under wasm32-wasip2 (wasmtime) (push) Successful in 2m23s
wai-quantum variational and algorithm library / parameters, gradients, optimisers, VQE, QAOA and builders · linux, release (push) Successful in 2m32s
wai-quantum energy-landscape jobs / the same bits · linux-arm64 (push) Successful in 14m7s
wai-quantum extension points / the registry and the example · linux (push) Successful in 4m9s
wai-quantum qudit jobs / the module, the job, the conformance set, the referee and the verb · linux (push) Successful in 6m2s
WAI Studio / the catalogue's actions, the unit tests and the core · linux (push) Successful in 54s
wai-quantum verdicts and repairs / the intent set and the verdict under wasm32-wasip2 (wasmtime) (push) Successful in 1m46s
wai-quantum for Python / python · linux (push) Successful in 8m53s
wai-quantum contract / schemas and the committed tool lists · linux (push) Successful in 15m9s
wai-quantum verdicts and repairs / verdicts, repairs and the intent set · linux (push) Successful in 2m39s
wai-quantum service / service · linux (push) Successful in 7m56s
wai-quantum studio and desktop / studio · browser (push) Successful in 8m6s
wai-quantum views in agent hosts / views · the page and its engine (push) Successful in 7m13s
wai-quantum views in agent hosts / views · a scripted host (push) Successful in 7m59s
WAI operation catalogue / the catalogue and every door · linux (push) Successful in 12m49s
wai-quantum studio and desktop / desktop app · linux (push) Successful in 10m56s
wai-quantum docs, course and locales / every command and snippet in the docs · linux (push) Successful in 20m40s
WAI Studio / Studio in WebKit · linux (push) Successful in 14m18s
WAI breaking changes and the conformance runner / WAI breaking · wire, record and API against main · linux (push) Successful in 2m47s
wai-quantum wasmQ / the reference modules rebuild to their modules of record · linux (push) Successful in 42s
wai-quantum wasmQ / interpreter and vectors under wasm32-wasip2 (wasmtime) (push) Successful in 4m12s
wai-quantum command line / command line · linux (push) Successful in 36m30s
wai-quantum wasmQ / profile, engines, reference modules, adversarial, vectors · linux (push) Successful in 8m57s
wai-quantum energy-landscape jobs / reader, kernels, answers and the stated result · linux, release (push) Successful in 11m21s
WAI breaking changes and the conformance runner / WAI breaking and conform · their tests, and the independent verifiers through wai conform · linux (push) Successful in 11m30s
wai-quantum energy-landscape jobs / native against WebAssembly, over many seeds (push) Successful in 11m11s
wai-quantum energy-landscape jobs / the module under wasm32-wasip2 (wasmtime) (push) Successful in 19m49s
wai-quantum studio and desktop / desktop app · windows (push) Successful in 10m0s
wai-quantum editors / editors · macos (push) Successful in 1m39s
wai-quantum command line / command line · macos (push) Successful in 2m45s
wai-quantum pulse and dynamics / the same bits · macos (push) Successful in 1m34s
wai-quantum for Python / python · macos (push) Successful in 3m11s
wai-quantum qudit jobs / the same bits · macos (push) Successful in 2m32s
wai-audit collector and player integration / collector, player integration and the browser end to end · macos (push) Successful in 4m0s
wai-quantum studio and desktop / desktop app · macos (push) Successful in 5m5s
wai-quantum service / service · macos (push) Successful in 7m7s
WAI Studio / Studio in Chromium and Firefox · macos (push) Successful in 10m33s
wai-sink-android native sink library / every ABI, the AAR, and the instrumented tests in a headless emulator · macos (push) Successful in 6m49s
wai-sink-swift native sink package / libwai slices, desktop tests, simulator tests · macos (push) Successful in 13m52s
wai-quantum wasmQ / profile, engines, reference modules, adversarial, vectors · macos (push) Successful in 2m16s
wai-quantum energy-landscape jobs / the same bits · macos (push) Successful in 6m34s
wai-quantum desktop release / the tag is the app's version (push) Successful in 15s
wai-quantum for JavaScript, release tarball / the tag is the command line's version (push) Successful in 8s
wai-quantum command line release / the tag is the crate's version (push) Successful in 23s
wai-quantum for Python, release wheels / the tag is the command line's version (push) Successful in 19s
wai-quantum for Python, release wheels / macOS · x86_64-apple-darwin (push) Successful in 1m52s
wai-quantum command line release / Linux · aarch64-unknown-linux-musl (push) Successful in 2m24s
wai-quantum for Python, release wheels / Linux · aarch64-unknown-linux-gnu (push) Successful in 2m23s
wai-quantum for Python, release wheels / Linux · x86_64-unknown-linux-gnu (push) Successful in 1m37s
wai-quantum desktop release / Linux · aarch64-unknown-linux-gnu (push) Successful in 10m57s
wai-quantum command line release / Linux · x86_64-unknown-linux-musl (push) Successful in 2m36s
wai-quantum for JavaScript, release tarball / the npm tarball · linux (push) Successful in 3m12s
wai-quantum desktop release / Linux · x86_64-unknown-linux-gnu (push) Successful in 13m57s
wai-quantum desktop release / Windows · x86_64-pc-windows-msvc (push) Successful in 11m51s
wai-quantum command line release / Windows · x86_64-pc-windows-msvc (push) Successful in 4m57s
wai-quantum for Python, release wheels / Windows · x86_64-pc-windows-msvc (push) Successful in 1m53s
wai-quantum desktop release / macOS · aarch64-apple-darwin (push) Successful in 4m11s
wai-quantum desktop release / macOS · x86_64-apple-darwin (push) Successful in 3m55s
wai-quantum desktop release / Homebrew cask, Scoop manifest and update manifest (push) Successful in 31s
wai-quantum command line release / macOS · aarch64-apple-darwin (push) Successful in 1m11s
wai-quantum command line release / macOS · x86_64-apple-darwin (push) Successful in 1m17s
wai-quantum for Python, release wheels / macOS · aarch64-apple-darwin (push) Successful in 43s
wai-quantum command line release / Homebrew formula and Scoop manifest (push) Successful in 26s
Every WAI Quantum package on a registry or a release today (crates.io 0.8.1, 0.4.1 and 0.2.4, PyPI 0.1.2, npm 0.1.1, the desktop app 0.1.2, the command line's archives, formula and manifest at 0.2.4) predates the strict receipt verifiers (#660, |
||
| .. | ||
| ci | ||
| test | ||
| build.sh | ||
| package.json | ||
| README.md | ||
@transaction-science/wai-quantum
The WAI quantum job service's engine in WebAssembly, for a page or for Node. A job is planned, run and sealed here exactly as the service plans, runs and seals it. The answer is the service's JSON, signed with a key you hold, and any job's receipt, the service's included, is checked here. Programs are linted, drawn and critiqued before they run.
This is version 0.1.2 of the package. It carries the engine of wai-quantum 0.9.0, built from wai-web with its quantum_engine feature. The package keeps its own version line, as the Python package does. The module also holds the rest of wai-web's browser surface (reading WAI envelopes among it); this page is about the quantum engine.
Install
npm install @transaction-science/wai-quantum
It is an ES module with its TypeScript declarations, and has no dependencies.
In a page
init() fetches wai_quantum_bg.wasm from beside the module. With a bundler that does not serve it there, pass its URL: init({ module_or_path: url }).
import init, { QuantumEngine, engine_verify } from '@transaction-science/wai-quantum';
await init();
const engine = new QuantumEngine(crypto.getRandomValues(new Uint8Array(32)), 256);
const text = engine.run(JSON.stringify({
qasm: 'OPENQASM 3.0; qubit[2] q; bit[2] c; h q[0]; cx q[0], q[1]; c = measure q;',
shots: 1000,
}));
const job = JSON.parse(text);
console.log(job.method, job.result.counts);
console.log(JSON.parse(engine_verify(text)).valid); // true: the receipt checked on the text it came in
In Node
Node is given the WebAssembly's bytes:
import init, { QuantumEngine, engine_verify } from '@transaction-science/wai-quantum';
import { readFile } from 'node:fs/promises';
import { createRequire } from 'node:module';
import { randomBytes } from 'node:crypto';
const wasm = createRequire(import.meta.url).resolve('@transaction-science/wai-quantum/wai_quantum_bg.wasm');
await init({ module_or_path: await readFile(wasm) });
const engine = new QuantumEngine(randomBytes(32), 256);
const text = engine.run(JSON.stringify({ qasm: 'OPENQASM 3.0; qubit[1] q; bit[1] c; h q[0]; c = measure q;', shots: 100 }));
console.log(JSON.parse(text).result.counts, JSON.parse(engine_verify(text)).signer);
What it offers
Requests and answers are JSON strings, the job service's own. A call that cannot be answered returns {"error": …}; a program the engine refuses also gives its diagnostic code (such as Q310) and its meaning.
new QuantumEngine(seed, memory_mb): an engine that signs with the Ed25519 key whose 32-byte seed is seed, and admits a job of at most memory_mb MiB. Keep the seed to keep the key.
signer_did(): the key the receipts name, as adid:key.run(request): a job run and sealed. The answer holdsstatus,method,why,requestandresult, with the result'sreceipt. The request is the service's (qasm,shots,seed,method,observables,amplitudes,noise,intent,verdict,target,compile,mitigateand more).plan(request): the method a job would run on and why, its memory and work, without running it.compile(request): a program compiled ({"qasm", "epsilon", "level", "basis"}), with a certificate of every pass, sealed.estimate(request): what a fault-tolerant machine would need to run a program, each estimate sealed.qec(op, args): error correction (code,decodeorthreshold), the answer sealed.landscape(op, request): an energy-landscape job (wai.quantum.landscape/1):opisrun,sweep,compareorreplay,requestthe job form's own (the program in epuML underprogram, and itsseed,temperature,seeds,temperaturesandparity). The answer (the state, its exact energy, every arrangement checked up to 16 variables, the verdict, the work, the joules priced at rates measured elsewhere, the replay digest, and the member that ran it at its parity) is sealed with the engine's key; a program the reader refuses gives{"error", "line"}.landscape_answer(op, request)gives the answer's bytes without a seal. Nothing here is a quantum effect: it is a classical emulation of a settling model.methods(): each method, its accuracy, and the most qubits it holds here.
Functions:
engine_verify(text): whether a job's receipt seals its request and result and every rule of its form holds (the provider protocol's section 8.4, and §8.6 for a set):{"valid", "reasons", "key", "form", "signer"}, each reason naming a rule broken. An energy-landscape job is held to its own form too (landscape_form, the extension's §5.4), and its verdict addslandscape: the operation, the member and its parity, each rule broken, and whether the answer's energy and plan are its program's (recomputed). Give it the job's text as it came: an object parsed and written out again by JavaScript can differ from what was sealed (a member named by digits moves first, and a large whole number is rewritten), and a member named twice is gone once it is parsed.engine_verdict(job, intent, memory_mb): a job's verdict against its intent (or the one given).engine_estimate_verify(answer): an estimate's seal, its receipts, and its request re-run to the same figures.engine_lint(src): a program read as the engine reads it:{"ok": true, "qubits", "gates", …}, or{"ok": false, "error", "line", "code"}.engine_draw(src, width): the circuit as text ({"text"});engine_layout(src)gives it as data for a page to draw.engine_critique(src): what the engine can say about a program before it runs: its measures and its smells, each with its lines.engine_equivalent(a, b): whether two programs apply the same gates up to a global phase, and how that was decided.engine_repair(src, options): a program repaired on the lines its diagnostics flag.engine_shortcuts(src, thorough): every exact classical route to simulating a program, with its cost.engine_diagnostic_codes(): every diagnostic code the reader uses, with its meaning.engine_course(locale), and the course's lessons, checks and hints: the circuits course, checked by the engine.
The declarations (wai_quantum.d.ts) list every export.
A run in a page or in Node does not meter its energy, and its result says so.
Elsewhere
The same engine runs as the command line (wai-quantum), as the Python package wai-quantum, and as the job service, and a job's receipt verifies in each. The source, its schemas and the versioning policy are at https://git.transaction.science/Transaction-Science/open-standards under wai/; Quantum Studio, an editor built on this package, is at https://wai.transaction.science/quantum-studio/.
Licence
Apache-2.0.