wai-quantum: the engine in editors (a language server, fmt, an OpenQASM 3 grammar, an editor extension) #517

Closed
dcharlot wants to merge 17 commits from wai/quantum-qlsp into main
Owner

The engine in any editor: a language server, a formatter, an OpenQASM 3 grammar, an editor extension, and configurations for other editors that speak the language server protocol.

Stacked on #516 (on #515, on #514). This PR's own commits are the six after #516.

  • engine::editor: the language service. It is pure, with no protocol in it, and builds for wasm32, so the Studio is one binding away.
    • Diagnostics: the reader's refusal on its line, and the critique's smells (gates that cancel, rotations that merge or do nothing, idle qubits, qubits never measured), each with its kind as the code.
    • Completion by what the cursor's place takes: qubits after a gate, values in parameters, integers in an index, bits after ->. Gates come with parameter placeholders, and an empty file offers sample programs.
    • Hover: each standard gate's matrix written exactly, checked entry by entry against the engine's own under all 46 accepted names. A user gate's matrix is computed from its gates. Each gate's cost is shown as the engine counts it.
    • Go to definition, references, rename, an outline, and folding, including // @lock blocks.
    • A formatter with one layout. It refuses rather than change any token.
  • wai-quantum lsp (stdio) serves it, with lenses (Run, Plan, Critique, Shortcuts, Receipt) run in-process and signed with the user's key. wai-quantum fmt prints, checks (--check) or writes (--write).
  • wai/tools/tree-sitter-openqasm: OpenQASM 3.1 plus OpenQASM 2's forms, with highlight, scope and fold queries. The generated parser is committed, and tree-sitter generate reproduces it exactly.
  • wai/tools/wai-quantum-editor: the editor extension.
    • Highlighting, plus a client for wai-quantum lsp with a configurable path and the install commands when the binary is missing.
    • Lens results go to an output panel, and a receipt can be saved as JSON.
    • It packages to a .vsix. It is not published; listing it needs publisher accounts.
  • editors/: configurations for other editors (a Lua configuration, a languages.toml, and an extension manifest with a small Rust part).
  • CI: wai-quantum-editors.yml runs the server tests, the grammar's corpus and highlight tests, the extension's packaging check, and fmt over every program in the repo, checking it is stable on a second pass and that the engine draws the result the same or refuses it alike.

Tests, on the Linux build host after stacking: engine engine:: 153 passed (engine::editor 20); CLI 1 + 40 + 5 + 2 + 5 passed (tests/lsp.rs drives a full stdio session); clippy clean with and without default features; the wasm32-wasip2 build; smoke.sh; service 19 passed. The builder also ran the grammar (17 corpus tests, 15 highlight assertions, 25 of 25 repo programs) and the extension check (79 checks).

🤖 Generated with Claude Code

The engine in any editor: a language server, a formatter, an OpenQASM 3 grammar, an editor extension, and configurations for other editors that speak the language server protocol. Stacked on #516 (on #515, on #514). This PR's own commits are the six after #516. - **`engine::editor`:** the language service. It is pure, with no protocol in it, and builds for wasm32, so the Studio is one binding away. - Diagnostics: the reader's refusal on its line, and the critique's smells (gates that cancel, rotations that merge or do nothing, idle qubits, qubits never measured), each with its kind as the code. - Completion by what the cursor's place takes: qubits after a gate, values in parameters, integers in an index, bits after `->`. Gates come with parameter placeholders, and an empty file offers sample programs. - Hover: each standard gate's matrix written exactly, checked entry by entry against the engine's own under all 46 accepted names. A user gate's matrix is computed from its gates. Each gate's cost is shown as the engine counts it. - Go to definition, references, rename, an outline, and folding, including `// @lock` blocks. - A formatter with one layout. It refuses rather than change any token. - **`wai-quantum lsp`** (stdio) serves it, with lenses (Run, Plan, Critique, Shortcuts, Receipt) run in-process and signed with the user's key. **`wai-quantum fmt`** prints, checks (`--check`) or writes (`--write`). - **`wai/tools/tree-sitter-openqasm`:** OpenQASM 3.1 plus OpenQASM 2's forms, with highlight, scope and fold queries. The generated parser is committed, and `tree-sitter generate` reproduces it exactly. - **`wai/tools/wai-quantum-editor`:** the editor extension. - Highlighting, plus a client for `wai-quantum lsp` with a configurable path and the install commands when the binary is missing. - Lens results go to an output panel, and a receipt can be saved as JSON. - It packages to a `.vsix`. It is not published; listing it needs publisher accounts. - **`editors/`:** configurations for other editors (a Lua configuration, a `languages.toml`, and an extension manifest with a small Rust part). - **CI:** `wai-quantum-editors.yml` runs the server tests, the grammar's corpus and highlight tests, the extension's packaging check, and `fmt` over every program in the repo, checking it is stable on a second pass and that the engine draws the result the same or refuses it alike. Tests, on the Linux build host after stacking: engine `engine::` 153 passed (`engine::editor` 20); CLI 1 + 40 + 5 + 2 + 5 passed (`tests/lsp.rs` drives a full stdio session); clippy clean with and without default features; the wasm32-wasip2 build; `smoke.sh`; service 19 passed. The builder also ran the grammar (17 corpus tests, 15 highlight assertions, 25 of 25 repo programs) and the extension check (79 checks). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The language the reader takes, its diagnostics (each refusal with what to
write instead, held to the reader by a test of every entry), the methods
and their accuracy classes, worked examples each with its intent, and the
rules an agent keeps. Both MCP servers serve these as resources and
prompts through engine::guide::handle.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
POST /mcp now serves resources/list, resources/read, prompts/list and
prompts/get from engine::guide: the language, the diagnostics, the
methods at this service's job memory, and the worked examples; and the
three prompts, each naming this server's own tools. initialize carries
the rules. server.json describes the endpoint in the MCP registry's
format (not submitted). A test holds the command line's snapshot of these
tools (wai-quantum-cli/docs/service-mcp.json) to the live list, and the
workflow runs when that snapshot changes. The edits rule now says
history_commit is a tool of the command line's server.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- new DIR --template bell|ghz|grover|noisy-bell: the program, intent.json,
  test.sh, ci/check.sh and an example workflow, mcp.json and AGENTS.md;
  its test passes as made.
- test: every intent checked by the engine (an exact distribution by the
  state vector or, under noise, the density matrix; a reference by the
  equivalence ladder; a state from |0...0>), the run and the check both
  sealed with the user's key, the check binding the run's receipt.
- setup-agent: the block between <!-- wai-quantum:start --> and
  <!-- wai-quantum:end --> in AGENTS.md, from the live tool lists and the
  engine's rules; a rerun replaces only the block; --check for CI.
- mcp config / mcp install --file PATH: the server's entry in the common
  mcpServers form, merged keeping every other entry; a different entry is
  refused without --force.
- The stdio server serves the engine's resources and prompts.
- docs: the resources offline, llms.txt and llms-full.txt (committed in
  docs/, held by a test to both servers' tool lists and this help), and
  the Agent Skill in skills/wai-quantum/. server.json for the registry.
- Tests for every verb, an end-to-end test through the binary, and smoke
  checks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
wai-quantum: the front door's changelog entry in wai/CHANGELOG.md
Some checks failed
WAI energy receipts / energy receipts · linux-arm64 (pull_request) Successful in 12m32s
wai-quantum HIP member / member · HIP absent (linux-arm64) (pull_request) Successful in 27s
wai-quantum npu-cores member / member · npu-cores absent (linux-arm64) (pull_request) Successful in 24s
wai-quantum tensor-engine member / member · tensor engine absent (linux-arm64) (pull_request) Successful in 22s
WAI examples / WAI examples · android-app · linux-arm64 (pull_request) Successful in 5m21s
wai-sink-android native sink library / the JNI layer and the platform-free half on the host JVM · linux-arm64 (pull_request) Successful in 3m6s
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Successful in 26m0s
wai-audit collector and player integration / collector, player integration and the browser end to end · macos (pull_request) Failing after 1m3s
WAI conformance / cross-arch byte-equality · macos (pull_request) Successful in 36s
WAI energy receipts / energy receipts · macos (pull_request) Has been cancelled
WAI examples / WAI examples · the archive, the readiness check, the browser and Apple · macos (pull_request) Has been cancelled
wai-quantum command line / command line · macos (pull_request) Has been cancelled
wai-quantum dataflow member / member · dataflow device absent (macos) (pull_request) Has been cancelled
wai-quantum FPGA member / member · FPGA datapath, simulated (macos) (pull_request) Has been cancelled
wai-quantum Metal member / member · Metal (macos) (pull_request) Has been cancelled
wai-quantum neural-processor member / member · neural processor (macos) (pull_request) Has been cancelled
wai-quantum OpenCL member / member · OpenCL GPU (macos) (pull_request) Has been cancelled
WAI conformance / independent verifiers · claims, JWP, key discovery and integer payloads (Python) (pull_request) Has been cancelled
wai-quantum service / service · macos (pull_request) Has been cancelled
wai-quantum matrix-extension member / member · matrix extension absent (macos) (pull_request) Has been cancelled
wai-quantum studio and desktop / desktop app · macos (pull_request) Has been cancelled
wai-quantum portable tensor program / tensor program · Metal and the arm64 CPU (macos) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector unit absent (macos) (pull_request) Has been cancelled
wai-quantum WebGPU member / member · Metal (macos) (pull_request) Has been cancelled
wai-quantum WebGPU member / member · browser WebGPU (macos) (pull_request) Has been cancelled
wai-sink-android native sink library / every ABI, the AAR, and the instrumented tests in a headless emulator · macos (pull_request) Has been cancelled
wai-sink-swift native sink package / libwai slices, desktop tests, simulator tests · macos (pull_request) Has been cancelled
WAI conformance / cargo-class corpora · macos (pull_request) Has been cancelled
standards workspaces build + test / macOS energy backends (pull_request) Has been cancelled
WAI conformance / codec wrappers · fuzz smoke, text decode limits, C entry points, provenance, the semantic path (pull_request) Has been cancelled
44140418b9
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The drawing the Studio makes from the layout, written once in the engine for
hosts with no page of their own (a notebook, a report, a file): the same
classes and geometry, a style sheet of its own scoped to .wq-circuit that
follows the text colour it is placed in, every number written to two
decimals so the same program writes the same bytes everywhere. Given whose
hand each operation is in, each gate is marked with its author and a key
under the drawing counts them; a condition legend and a note past 400
columns. Five tests: the Bell pair glyph by glyph, every layout item drawn
and the bytes repeatable, the authorship marks and key, escaping and number
writing, and the column cap.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A new crate, wai/wai-quantum-py, built by maturin 1.15.0 into one abi3 wheel
per platform (pyo3 0.29.3, Python 3.9 on), module wai_quantum. Its extension
module wraps the shared job engine and nothing else: run, plan, lint, draw
(text and the engine SVG), layout, critique, improve, shortcuts,
equivalent, verify, seal, canonical, digest, methods, accuracy_classes and
history, values crossing one to one with JSON (NaN, integers past 64 bits
and non-string keys refused). A job is the service form as a plain dict
with helpers (counts, probabilities, expectations, amplitudes, method,
accuracy, receipt); Key reads and writes the command line key files and
finds the same user key; bloch gives each qubit reduced state from the
engine expectation values. A refusal raises EngineError with the engine
message, its line, and a code slot for the engine diagnostic codes.

Service is a client in the standard library alone for the job service
(submit, status, result, cancel, run), naming itself
wai-quantum-python/<version>, its receipts checked here offline.

Widgets (the widgets extra): Circuit (the engine drawing, gates clickable,
authorship marks from a history), Result, Receipt (the engine verdict) and
Bloch (drag to turn), each a plain ES module, each with static HTML (and
SVG) fallbacks that render without the widget library.

Five doc notebooks run in CI and are held to their stored outputs.
ci/check.sh is the whole check; 62 pytest tests hold the package to the
command line (same results, plans, lints, critiques, drawings, methods,
equivalence verdicts; receipts verified both ways; the same user key; the
digest recomputed from Python canonical bytes), to the service run locally,
and run the front ends under node on the payloads; Python 3.9 smoke with
the wheel alone. Workflow wai-quantum-py.yml runs it on linux and macos.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A page that strips <style> from what it shows (a notebook sanitising an
untrusted output) would leave unstyled lines with no stroke and the
background rectangle filled black. Each line and path now carries a stroke
in the text colour, each text and dot a fill, each box, ring and meter an
outline with no fill, the background none and each key swatch its hand
colour; the style sheet still overrides them all. A sixth test checks every
element of a drawing for its attribute. The doc notebooks are written again
with the new drawing, and ci/check.sh expands an empty array the way the
bash macOS ships accepts under set -u.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
wai-quantum-py: release wheels on the command line tag; changelog and README
Some checks failed
WAI conformance / cross-arch byte-equality · macos (pull_request) Successful in 36s
WAI examples / WAI examples · the archive, the readiness check, the browser and Apple · macos (pull_request) Has been cancelled
wai-quantum command line / command line · macos (pull_request) Has been cancelled
wai-quantum dataflow member / member · dataflow device absent (macos) (pull_request) Has been cancelled
wai-quantum FPGA member / member · FPGA datapath, simulated (macos) (pull_request) Has been cancelled
wai-quantum HIP member / member · HIP absent (linux-arm64) (pull_request) Has been cancelled
wai-quantum Metal member / member · Metal (macos) (pull_request) Has been cancelled
wai-quantum npu-cores member / member · npu-cores absent (linux-arm64) (pull_request) Has been cancelled
wai-quantum neural-processor member / member · neural processor (macos) (pull_request) Has been cancelled
WAI conformance / independent verifiers · claims, JWP, key discovery and integer payloads (Python) (pull_request) Has been cancelled
wai-quantum OpenCL member / member · OpenCL GPU (macos) (pull_request) Has been cancelled
WAI conformance / codec wrappers · fuzz smoke, text decode limits, C entry points, provenance, the semantic path (pull_request) Has been cancelled
wai-quantum for Python / python · macos (pull_request) Has been cancelled
wai-quantum service / service · macos (pull_request) Has been cancelled
wai-quantum matrix-extension member / member · matrix extension absent (macos) (pull_request) Has been cancelled
WAI examples / WAI examples · android-app · linux-arm64 (pull_request) Has been cancelled
wai-quantum studio and desktop / desktop app · macos (pull_request) Has been cancelled
WAI conformance / cargo-class corpora · macos (pull_request) Has been cancelled
WAI conformance / each feature of the independent verifiers' steps compiles alone (pull_request) Has been cancelled
wai-quantum tensor-engine member / member · tensor engine absent (linux-arm64) (pull_request) Has been cancelled
wai-quantum portable tensor program / tensor program · Metal and the arm64 CPU (macos) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector unit absent (macos) (pull_request) Has been cancelled
wai-quantum WebGPU member / member · Metal (macos) (pull_request) Has been cancelled
wai-quantum WebGPU member / member · browser WebGPU (macos) (pull_request) Has been cancelled
wai-sink-android native sink library / the JNI layer and the platform-free half on the host JVM · linux-arm64 (pull_request) Has been cancelled
wai-sink-android native sink library / every ABI, the AAR, and the instrumented tests in a headless emulator · macos (pull_request) Has been cancelled
wai-sink-swift native sink package / libwai slices, desktop tests, simulator tests · macos (pull_request) Has been cancelled
WAI energy receipts / energy receipts · macos (pull_request) Has been cancelled
WAI energy receipts / energy receipts · linux-arm64 (pull_request) Has been cancelled
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Has been cancelled
2f081db716
wai-quantum-py-release.yml builds the abi3 wheels on a wai-quantum-cli-v*
tag and attaches each with its SHA-256 to that forge release, as the
command line archives are (release/publish.sh, over the private network):
macOS arm64 and x86_64 (cross-built on the Apple-silicon runner), Linux
x86_64 and arm64 as manylinux2014 (maturin with zig 0.16.0, so the
runner glibc does not leak into the wheel; checked: the module needs
GLIBC_2.17 at most), and Windows x86_64. Each wheel that runs on its runner
is installed alone on Python 3.9 and runs tests/smoke.py first. Nothing is
published to a package index.

The changelog entry (wai/CHANGELOG.md), the crate README naming
engine::svg and the package, and ci/check.sh waiting on the service it
stops so the shell prints no job notice.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
engine::provider says what a provider job may ask (counts of a program
whose measurements come at the end and whose angles are dyadic, so it
compiles exactly to a device's gates), turns the device's counts into a
result labelled measured with the circuit's exact distribution beside
them (total variation distance, Hellinger fidelity, and what the shots
alone would leave), and seals it so job::verify checks it.

catalog::read refuses a request that names a provider, so a host that
reaches none (the job service) never runs one on its own methods.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- open_provider: the open provider protocol, wai.quantum.provider/1, over
  HTTP (curl, a credential only over https or to this machine) or a local
  process (one JSON line each way, the credential in its environment);
  a program travels in the device's gates with every angle an exact
  dyadic fraction of a turn, and its OpenQASM 3 beside it.
- reference: the protocol around the exact simulator, served both ways
  (wai-qpu reference --stdio | --http ADDR): the provider the tests run
  against, and the template to copy. Free, or priced per shot or job in
  exact decimals; polls, readout error and a credential checked by hash.
- conformance: the checker and its vectors (conformance/provider-v1.json),
  with the reference's counts pinned; jobs run only when free or allowed.
- registry: the person's list in their configuration directory, holding
  no credential; credentials in the keychain (the system security tool,
  or secret-tool), else a 0600 file, and every listing says which.
- job: the dry run (exact native compile, the check by simulation, the
  provider's estimate and billing unit), the refusal of a run that is not
  free until it is confirmed, and the seal of its counts by the engine.
- Provider gains details, estimate, a seeded submit and cancel, with
  defaults, so the three built-in clients keep working unchanged.

CI: the QPU workflow pins the three test binaries' counts and the new
tests by name, and a macOS leg runs the keychain test in its own
keychain file.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- providers add|list|remove|describe|test|free|reference: the person's
  own providers in their registry, a credential read from standard input
  (never a command line) into the keychain, or named by an environment
  variable; describe and the conformance test; what anyone can use free;
  and the reference provider served by this binary, as a template.
- run --provider NAME [--dry-run] [--yes]: the plan with the exact native
  compile, its check and the provider's estimate; a run that is not free
  refused (exit 3) until --yes; the counts sealed with this user's key,
  checked by verify.
- MCP: providers_list, provider_estimate and run_on_provider; the last
  says it can spend the person's money and refuses without
  confirm_cost: true when the run is not free.
- A `providers` feature (default) carries it, so the WASI build without
  default features stays as it was.

CI: the command line's workflow follows wai-quantum-qpu and pins the five
end-to-end tests by name.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Desktop: providers_list, provider_estimate and run_on_provider
  commands; the app reads the credential from the keychain, seals the
  counts with the user's key, and refuses a run that is not free unless
  the page confirms it.
- Studio: a "Your hardware" switch. In the desktop app it lists the
  person's providers, asks for the estimate first and shows a dialog
  before a run that is not free; in a browser tab it says such runs go
  through the desktop app or the command line, since a tab must not hold
  a provider's credential.
- Tests: test/hardware.test.mjs (the switch's logic without a browser),
  a check in the browser test, and a desktop test of the estimate, the
  refusal and the sealed run. The Studio workflow runs the first and
  pins the last, and follows wai-quantum-qpu.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- extensions/quantum-providers.md: wai.quantum.provider/1, its two
  transports, its messages and error codes, the program in a device's
  own gates with exact angles, the six operations, the bit order, the
  cost and confirmation rules, what the receipt proves and what it does
  not, the conformance vectors and the reference provider.
- wai-quantum-qpu/bring-your-own-quantum.md: what is free, adding a
  provider of each kind with its credential in the keychain, running on
  it from the command line, an agent and the desktop, the reference as a
  template, the receipt, and what a person does to connect a real device.
- The READMEs of wai-quantum-qpu, the command line, the engine and the
  job service (which never routes to a provider or takes a credential),
  and the CHANGELOG.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
wai-quantum: agents may use the person's own providers; one tool list for every reader
Some checks failed
wai-quantum studio and desktop / studio · browser (pull_request) Has been cancelled
wai-quantum studio and desktop / desktop app · macos (pull_request) Has been cancelled
wai-quantum tensor-engine member / member · tensor engine, the kernel toolchain's simulator (linux) (pull_request) Has been cancelled
wai-quantum tensor-engine member / member · tensor engine absent (linux-arm64) (pull_request) Has been cancelled
wai-quantum portable tensor program / tensor program · CPU, mutants, GPU builds (pull_request) Has been cancelled
wai-quantum portable tensor program / tensor program · Metal and the arm64 CPU (macos) (pull_request) Has been cancelled
wai-quantum dataflow member / member · dataflow device, simulated (pci 1e52:401e) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector unit, rvv 1024-bit (riscv64, emulated) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector unit, sve 128-bit (aarch64, emulated) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector unit, rvv 128-bit (riscv64, emulated) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector unit, sve 2048-bit (aarch64, emulated) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector unit, avx2 (x86_64 silicon) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector unit, sve 512-bit (aarch64, emulated) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector unit absent (macos) (pull_request) Has been cancelled
wai-quantum signal processor / processor and member · signal processor, emulated (pull_request) Has been cancelled
wai-quantum WebGPU member / shader checks · browser build · wasip2 inertness · MSRV (pull_request) Has been cancelled
wai-quantum WebGPU member / member · software Vulkan (linux) (pull_request) Has been cancelled
wai-quantum WebGPU member / member · Metal (macos) (pull_request) Has been cancelled
wai-quantum WebGPU member / member · browser WebGPU (macos) (pull_request) Has been cancelled
WAI conformance / cargo-class corpora · macos (pull_request) Has been cancelled
wai-sink-android native sink library / every ABI, the AAR, and the instrumented tests in a headless emulator · macos (pull_request) Has been cancelled
wai-sink-swift native sink package / libwai slices, desktop tests, simulator tests · macos (pull_request) Has been cancelled
wai-web wasm32 / wai-web wasm32 build · corpus, menu and writers (pull_request) Has been cancelled
wai-sink-android native sink library / the JNI layer and the platform-free half on the host JVM · linux-arm64 (pull_request) Has been cancelled
WAI energy receipts / energy receipts · linux (pull_request) Has been cancelled
WAI examples / WAI examples · portable · linux (pull_request) Has been cancelled
WAI energy receipts / energy receipts · linux-arm64 (pull_request) Has been cancelled
WAI conformance / cargo-class corpora · linux (pull_request) Has been cancelled
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Has been cancelled
wai-quantum WebGPU member / member · discrete GPU, Vulkan (jetson-hub) (pull_request) Has been cancelled
9ac35dcfc9
- engine::guide: the route rule allows a quantum provider the person
  added themselves, only for a run they ask for, and the Agent Skill says
  how (dry run, cost, the person's yes).
- The stdio MCP server's tools() now includes the provider tools, so
  tools/list, the generated llms.txt, llms-full.txt, the AGENTS.md block
  and the skill's tool reference list the same tools.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The engine gains `engine::editor`, the language service an editor needs,
pure and with no protocol in it:

- diagnostics: the reader's refusal on its line (one mapping function,
  `reader_diagnostic`, where stable codes and exact spans plug in), and
  the critique's smells on theirs, with their kind as the code; a
  generator is read at the given inputs, or 4;
- completion of keywords, the standard gates (with parameter
  placeholders), and the registers, gates, subroutines and variables in
  scope, by what the cursor's place takes; snippets, and sample programs
  in an empty file;
- hover: each standard gate's matrix written exactly, held entry by entry
  to the engine's own matrix under all 46 names the reader accepts; a
  user gate's matrix from the engine's matrices of its gates; each gate's
  cost as the engine counts it (two-qubit gates, T count, depth), at the
  call's angles or at generic ones, said which; a register's size;
- definition, references, highlights and rename over an index of
  declarations and scopes that reads the whole of OpenQASM 3, and a
  half-typed program; symbols, folding (blocks, comments, held blocks);
- a formatter with one layout, refusing a program whose brackets do not
  match, checked to keep every token, and tested stable and
  meaning-preserving (the engine reads the formatted program to the same
  circuit) on a corpus in every part of the language;
- lenses for Run, Plan, Critique, Shortcuts and Receipt.

The command line gains two verbs. `wai-quantum lsp` serves it over
standard input and output, UTF-16 or UTF-8 positions as agreed, the
commands run in-process on a thread of their own and signed with the
user's key; `wai-quantum fmt` formats, `--check`s and `--write`s.
tests/lsp.rs drives the binary through a scripted session from
initialize to exit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The grammar reads every statement of OpenQASM 3.1 (declarations of every
type, gates, subroutines and externs, modifiers and gphase, control flow,
timing, calibrations kept as text with their braces matched, pragmas and
annotations) and OpenQASM 2's qreg, creg, opaque, measure q -> c and
if(c==1). The parser is generated at ABI 14 with the pinned command line
(0.26.13) and committed; regenerating it reproduces it byte for byte.

Queries for highlighting, scopes and folds; 17 corpus tests checked tree
for tree, and the highlighting checked by 15 assertions.
script/check-programs.mjs parses every program in the repository's
conformance material and examples (the tracked .qasm files, the Studio's
worked examples, the language service's samples, the programs in the
command line's README and smoke script): 25 of 25 parse with no error,
and a broken program is refused, so a clean result means something.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The extension highlights OpenQASM (a TextMate grammar) and starts
`wai-quantum lsp` (path, extra arguments, generator inputs and shots in
its settings). Its lenses and palette commands run Run, Plan, Critique,
Shortcuts and Receipt through the server, and each answer goes to an
output panel; a receipt can be saved as JSON. When the command line is
missing it says so, with the install commands of the command line's
README, and offers the setting for its path. It builds to one bundled
file and packages to a .vsix with the pinned packaging tool; it is not
published.

editors/ holds a configuration for three kinds of editor: one configured
in Lua (the server through the built-in configuration or the lspconfig
plugin, the grammar through the tree-sitter plugin, and a command for each
of the server's commands), one configured by languages.toml (the server,
the formatter and the grammar, with its queries in that editor's capture
names), and one with WebAssembly extensions described by extension.toml (a
small extension that finds and starts the server, built for
wasm32-wasip2; every locked crate is at least two weeks old).

test/check.mjs (79 checks) holds the manifest to the server's commands,
the highlighting token by token, the missing-binary message to the
README, every configuration to its syntax and to the server and the
grammar, the query copies to the grammar's, and the package to exactly
the extension's files.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
On linux: the language service's tests (each module shown to have run),
the language server's scripted session over standard input and output and
its unit tests, the grammar regenerated with the pinned command line and
held identical to the committed parser, its corpus and highlighting, every
program in the repository parsed with no error, `wai-quantum fmt` on each
of those programs (stable on a second pass, and drawn by the engine as the
original is, or refused alike), the editor extension packaged and checked
with the built command line, and the WebAssembly extension built for
wasm32-wasip2. On macos: the language service's tests and the server's
session.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The command line's README gains an Editors section (what the language
server brings, `wai-quantum fmt`, where the extension, the other editors'
configurations and the grammar are, and a client configuration of one's
own); the engine's README names `engine::editor` with the rest of the
engine; wai/CHANGELOG.md records the whole of it. smoke.sh checks that
fmt gives the one layout, that --check tells formatted from not, that a
program whose brace is not closed is refused with its line, and that the
server answers initialize and exits cleanly after shutdown.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
wai-quantum-cli docs: llms-full.txt with the lsp and fmt verbs
Some checks failed
wai-quantum studio and desktop / studio · browser (pull_request) Has been cancelled
wai-quantum studio and desktop / desktop app · macos (pull_request) Has been cancelled
wai-quantum tensor-engine member / member · tensor engine, the kernel toolchain's simulator (linux) (pull_request) Has been cancelled
wai-quantum tensor-engine member / member · tensor engine absent (linux-arm64) (pull_request) Has been cancelled
WAI conformance / codec wrappers · fuzz smoke, text decode limits, C entry points, provenance, the semantic path (pull_request) Has been cancelled
wai-quantum portable tensor program / tensor program · CPU, mutants, GPU builds (pull_request) Has been cancelled
wai-quantum portable tensor program / tensor program · integrated GPU (framework-128gb) (pull_request) Has been cancelled
wai-quantum portable tensor program / tensor program · Metal and the arm64 CPU (macos) (pull_request) Has been cancelled
WAI conformance / fast integer kernels, every x86_64 kernel set (AVX-512 silicon) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector unit, rvv 1024-bit (riscv64, emulated) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector unit, sve 128-bit (aarch64, emulated) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector unit, rvv 128-bit (riscv64, emulated) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector unit, sve 2048-bit (aarch64, emulated) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector unit, avx2 (x86_64 silicon) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector unit, sve 512-bit (aarch64, emulated) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector units, avx2 and avx512 (framework-128gb silicon) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector unit absent (macos) (pull_request) Has been cancelled
wai-quantum WebGPU member / shader checks · browser build · wasip2 inertness · MSRV (pull_request) Has been cancelled
wai-quantum WebGPU member / member · software Vulkan (linux) (pull_request) Has been cancelled
wai-quantum WebGPU member / member · Metal (macos) (pull_request) Has been cancelled
wai-quantum WebGPU member / member · integrated GPU, Vulkan (framework-128gb) (pull_request) Has been cancelled
wai-quantum WebGPU member / member · browser WebGPU (macos) (pull_request) Has been cancelled
wai-sink-android native sink library / the JNI layer and the platform-free half on the host JVM · linux-arm64 (pull_request) Has been cancelled
wai-sink-android native sink library / every ABI, the AAR, and the instrumented tests in a headless emulator · macos (pull_request) Has been cancelled
wai-sink-swift native sink package / libwai slices, desktop tests, simulator tests · macos (pull_request) Has been cancelled
wai-web wasm32 / wai-web wasm32 build · corpus, menu and writers (pull_request) Has been cancelled
wai-web reach builds / wai-web reach builds · this tree's wai-web, every rung on its engine line (pull_request) Has been cancelled
wai-web reach builds / wai-web reach builds · the package of record, every output as recorded (pull_request) Has been cancelled
WAI conformance / cargo-class corpora · macos (pull_request) Has been cancelled
wai-quantum WebGPU member / member · discrete GPU, Vulkan (jetson-hub) (pull_request) Has been cancelled
67a6cb7fb7
Co-Authored-By: Claude Opus 5.5 <[email protected]>
wai-quantum: the route rule reads plainly; a project's test.sh takes a relative command path
All checks were successful
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Successful in 20m28s
wai-quantum tensor-engine member / member · tensor engine absent (linux-arm64) (pull_request) Successful in 19s
WAI examples / WAI examples · android-app · linux-arm64 (pull_request) Successful in 4m51s
wai-sink-android native sink library / the JNI layer and the platform-free half on the host JVM · linux-arm64 (pull_request) Successful in 2m16s
WAI conformance / independent verifiers · claims, JWP, key discovery and integer payloads (Python) (pull_request) Successful in 57m25s
wai-audit collector and player integration / collector, player integration and the browser end to end · macos (pull_request) Successful in 1m25s
WAI conformance / cross-arch byte-equality · macos (pull_request) Successful in 29s
WAI conformance / codec wrappers · fuzz smoke, text decode limits, C entry points, provenance, the semantic path (pull_request) Successful in 1m22s
standards workspaces build + test / macOS energy backends (pull_request) Successful in 10m53s
WAI energy receipts / energy receipts · macos (pull_request) Successful in 7m22s
wai-quantum command line / command line · macos (pull_request) Successful in 42s
wai-quantum dataflow member / member · dataflow device absent (macos) (pull_request) Successful in 14s
wai-quantum editors / editors · macos (pull_request) Successful in 49s
wai-quantum FPGA member / member · FPGA datapath, simulated (macos) (pull_request) Successful in 1m10s
wai-quantum Metal member / member · Metal (macos) (pull_request) Successful in 31s
WAI examples / WAI examples · the archive, the readiness check, the browser and Apple · macos (pull_request) Successful in 12m54s
wai-quantum OpenCL member / member · OpenCL GPU (macos) (pull_request) Successful in 23s
WAI conformance / cargo-class corpora · macos (pull_request) Successful in 20m0s
wai-quantum-qpu / credentials in the keychain (macos) (pull_request) Successful in 18s
wai-quantum for Python / python · macos (pull_request) Successful in 1m18s
wai-quantum matrix-extension member / member · matrix extension absent (macos) (pull_request) Successful in 11s
wai-quantum service / service · macos (pull_request) Successful in 47s
wai-quantum portable tensor program / tensor program · Metal and the arm64 CPU (macos) (pull_request) Successful in 17s
wai-quantum CPU vector units / member · vector unit absent (macos) (pull_request) Successful in 15s
wai-quantum neural-processor member / member · neural processor (macos) (pull_request) Successful in 9m24s
wai-quantum studio and desktop / desktop app · macos (pull_request) Successful in 2m45s
wai-quantum WebGPU member / member · browser WebGPU (macos) (pull_request) Successful in 1m45s
wai-quantum WebGPU member / member · Metal (macos) (pull_request) Successful in 2m34s
wai-sink-android native sink library / every ABI, the AAR, and the instrumented tests in a headless emulator · macos (pull_request) Successful in 7m3s
wai-sink-swift native sink package / libwai slices, desktop tests, simulator tests · macos (pull_request) Successful in 19m2s
d7afb5f9fc
- engine::guide's route rule ends "and nowhere else": the service's
  instructions join every rule on one line, where the old ending and the
  signing-key rule read together as a comparison to the prose check.
- test.sh makes a relative WAI_QUANTUM absolute before it changes to the
  project's directory, and smoke.sh runs the binary by an absolute path:
  CI gives it ./target/release/wai-quantum.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
dcharlot closed this pull request 2026-10-27 20:09:51 -04:00
Some checks failed
wai-quantum WebGPU member / member · DX12 and Vulkan (cbio-windows) (pull_request) Successful in 12m13s
wai-quantum on every processor / emulated · aarch64-unknown-linux-gnu (pull_request) Successful in 1m1s
wai-quantum on every processor / emulated · armv7-unknown-linux-gnueabihf (pull_request) Successful in 1m43s
wai-quantum on every processor / emulated · loongarch64-unknown-linux-gnu (pull_request) Successful in 1m54s
wai-quantum on every processor / emulated · riscv64gc-unknown-linux-gnu (pull_request) Successful in 46s
wai-quantum on every processor / emulated · powerpc64-unknown-linux-gnu (pull_request) Successful in 3m3s
wai-quantum on every processor / emulated · powerpc64le-unknown-linux-gnu (pull_request) Successful in 4m13s
wai-web reach builds / wai-web reach · does this change touch it (pull_request) Successful in 5s
wai-quantum on every processor / emulated · s390x-unknown-linux-gnu (pull_request) Successful in 3m22s
standards workspaces build + test / which workspaces this change touches (pull_request) Successful in 8s
wai-audit collector and player integration / does this change touch it (pull_request) Successful in 7s
WAI conformance / does this change touch it (pull_request) Successful in 11s
WAI energy receipts / does this change touch it (pull_request) Successful in 9s
WAI examples / WAI examples · does this change touch them (pull_request) Successful in 9s
wai-quantum command line / does this change touch it (pull_request) Successful in 16s
wai-quantum CUDA member / does this change touch it (pull_request) Successful in 15s
wai-quantum dataflow member / does this change touch it (pull_request) Successful in 12s
wai-quantum on every processor / emulated · sparc64-unknown-linux-gnu (pull_request) Successful in 4m35s
wai-quantum signal processor / does this change touch it (pull_request) Successful in 13s
wai-quantum editors / does this change touch it (pull_request) Successful in 12s
wai-quantum FPGA member / does this change touch it (pull_request) Successful in 11s
wai-quantum HIP member / does this change touch it (pull_request) Successful in 13s
wai-quantum on every processor / emulated · i686-unknown-linux-gnu (pull_request) Successful in 5m29s
wai-quantum Metal member / does this change touch it (pull_request) Successful in 10s
wai-quantum npu-cores member / does this change touch it (pull_request) Successful in 10s
wai-quantum neural-processor member / does this change touch it (pull_request) Successful in 9s
wai-quantum OpenCL member / does this change touch it (pull_request) Successful in 10s
wai-quantum for Python / does this change touch it (pull_request) Successful in 9s
WAI conformance / fast integer kernels, every x86_64 kernel set (AVX-512 silicon) (pull_request) Successful in 3m3s
repository checks / lockfiles, advisories, tests in CI, workflow hygiene, spec and section references, public text (pull_request) Successful in 3m40s
wai-quantum-qpu / does this change touch it (pull_request) Successful in 10s
wai-quantum service / does this change touch it (pull_request) Successful in 9s
wai-quantum matrix-extension member / does this change touch it (pull_request) Successful in 9s
wai-quantum studio and desktop / does this change touch it (pull_request) Successful in 10s
wai-quantum tensor-engine member / does this change touch it (pull_request) Successful in 8s
wai-quantum HIP member / member · HIP (framework-128gb) (pull_request) Successful in 22s
wai-quantum portable tensor program / does this change touch it (pull_request) Successful in 11s
wai-quantum CPU vector units / does this change touch it (pull_request) Successful in 11s
wai-quantum WebGPU member / does this change touch it (pull_request) Successful in 10s
wai-sink-android native sink library / does this change touch it (pull_request) Successful in 9s
wai-sink-swift native sink package / does this change touch it (pull_request) Successful in 9s
wai-web wasm32 / does this change touch it (pull_request) Successful in 9s
wai-quantum npu-cores member / member · npu-cores, neural processor (framework-128gb silicon) (pull_request) Successful in 1m13s
wai-quantum OpenCL member / member · OpenCL GPU (framework-128gb) (pull_request) Successful in 16s
wai-quantum portable tensor program / tensor program · integrated GPU (framework-128gb) (pull_request) Successful in 9s
wai-quantum CPU vector units / member · vector units, avx2 and avx512 (framework-128gb silicon) (pull_request) Successful in 12s
wai-quantum CUDA member / member · CUDA (jetson-hub) (pull_request) Successful in 27s
wai-quantum OpenCL member / member · OpenCL GPU and CPU (jetson-hub) (pull_request) Successful in 25s
wai-quantum portable tensor program / tensor program · GPUs (jetson-hub) (pull_request) Successful in 17s
wai-quantum WebGPU member / member · integrated GPU, Vulkan (framework-128gb) (pull_request) Successful in 8m36s
wai-quantum WebGPU member / member · discrete GPU, Vulkan (jetson-hub) (pull_request) Successful in 23m8s
wai-web reach builds / wai-web reach builds · the package of record, every output as recorded (pull_request) Successful in 2m15s
wai-audit collector and player integration / collector · linux (pull_request) Successful in 1m12s
WAI conformance / cross-arch byte-equality · linux (pull_request) Successful in 32s
WAI conformance / faces from keypoints under wasm32-wasip2 (wasmtime) (pull_request) Successful in 1m36s
WAI conformance / quantum core and corpus under wasm32-wasip2 (wasmtime) (pull_request) Successful in 2m18s
wai-quantum CUDA member / member · CUDA absent (linux) (pull_request) Successful in 22s
wai-web reach builds / wai-web reach builds · this tree's wai-web, every rung on its engine line (pull_request) Successful in 4m28s
wai-quantum command line / command line · linux (pull_request) Successful in 2m8s
wai-quantum dataflow member / member · dataflow device, simulated (pci 1e52:b140) (pull_request) Successful in 3m35s
wai-quantum dataflow member / member · dataflow device, simulated (pci 1e52:401e) (pull_request) Successful in 4m27s
wai-quantum editors / editors · linux (pull_request) Failing after 1m24s
wai-quantum FPGA member / member · FPGA simulation absent (linux) (pull_request) Successful in 24s
wai-quantum Metal member / member · Metal absent (linux) (pull_request) Successful in 30s
wai-quantum neural-processor member / member · neural processor absent (linux) (pull_request) Successful in 22s
wai-quantum OpenCL member / member · OpenCL absent (linux) (pull_request) Successful in 26s
wai-quantum-qpu / clients against their contracts (linux) (pull_request) Successful in 38s
wai-quantum for Python / python · linux (pull_request) Successful in 1m45s
wai-quantum service / service · linux (pull_request) Successful in 53s
wai-quantum matrix-extension member / member · matrix extension, emulated (aarch64 Linux) (pull_request) Successful in 11s
WAI examples / WAI examples · portable · linux (pull_request) Successful in 8m41s
wai-quantum portable tensor program / tensor program · CPU, mutants, GPU builds (pull_request) Successful in 25s
wai-quantum CPU vector units / member · vector unit, rvv 1024-bit (riscv64, emulated) (pull_request) Successful in 7s
WAI energy receipts / energy receipts · linux (pull_request) Successful in 9m39s
wai-quantum CPU vector units / member · vector unit, sve 128-bit (aarch64, emulated) (pull_request) Successful in 14s
wai-quantum CPU vector units / member · vector unit, sve 2048-bit (aarch64, emulated) (pull_request) Successful in 10s
wai-quantum CPU vector units / member · vector unit, avx2 (x86_64 silicon) (pull_request) Successful in 6s
wai-quantum CPU vector units / member · vector unit, rvv 128-bit (riscv64, emulated) (pull_request) Successful in 22s
wai-quantum CPU vector units / member · vector unit, sve 512-bit (aarch64, emulated) (pull_request) Successful in 10s
wai-quantum studio and desktop / studio · browser (pull_request) Successful in 2m58s
wai-quantum WebGPU member / member · software Vulkan (linux) (pull_request) Successful in 2m10s
wai-quantum WebGPU member / shader checks · browser build · wasip2 inertness · MSRV (pull_request) Successful in 3m15s
wai-quantum tensor-engine member / member · tensor engine, the kernel toolchain's simulator (linux) (pull_request) Successful in 5m0s
WAI conformance / cargo-class corpora · linux (pull_request) Successful in 17m26s
WAI conformance / v2 vocabulary · manifests validate as stated (pull_request) Successful in 22s
wai-web wasm32 / wai-web wasm32 build · corpus, menu and writers (pull_request) Successful in 5m46s
wai-quantum signal processor / processor and member · signal processor, emulated (pull_request) Successful in 16m6s
standards workspaces build + test / joule-code-rs (joule-code/joule-code-rs, joule-code-rs, linux-arm64, true) (pull_request) Successful in 7m7s
WAI conformance / delivery telemetry · CMCD and CMSD against an independent library (pull_request) Successful in 12s
WAI conformance / cross-arch byte-equality · linux-arm64 (pull_request) Successful in 31s
WAI conformance / C2PA manifest emission · signed, read back, validated (pull_request) Successful in 1m48s
WAI conformance / each feature of the independent verifiers' steps compiles alone (pull_request) Successful in 10m23s
WAI energy receipts / energy receipts · linux-arm64 (pull_request) Successful in 9m3s
wai-quantum HIP member / member · HIP absent (linux-arm64) (pull_request) Successful in 31s
wai-quantum npu-cores member / member · npu-cores absent (linux-arm64) (pull_request) Successful in 56s
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Successful in 20m28s
wai-quantum tensor-engine member / member · tensor engine absent (linux-arm64) (pull_request) Successful in 19s
WAI examples / WAI examples · android-app · linux-arm64 (pull_request) Successful in 4m51s
wai-sink-android native sink library / the JNI layer and the platform-free half on the host JVM · linux-arm64 (pull_request) Successful in 2m16s
WAI conformance / independent verifiers · claims, JWP, key discovery and integer payloads (Python) (pull_request) Successful in 57m25s
wai-audit collector and player integration / collector, player integration and the browser end to end · macos (pull_request) Successful in 1m25s
WAI conformance / cross-arch byte-equality · macos (pull_request) Successful in 29s
WAI conformance / codec wrappers · fuzz smoke, text decode limits, C entry points, provenance, the semantic path (pull_request) Successful in 1m22s
standards workspaces build + test / macOS energy backends (pull_request) Successful in 10m53s
WAI energy receipts / energy receipts · macos (pull_request) Successful in 7m22s
wai-quantum command line / command line · macos (pull_request) Successful in 42s
wai-quantum dataflow member / member · dataflow device absent (macos) (pull_request) Successful in 14s
wai-quantum editors / editors · macos (pull_request) Successful in 49s
wai-quantum FPGA member / member · FPGA datapath, simulated (macos) (pull_request) Successful in 1m10s
wai-quantum Metal member / member · Metal (macos) (pull_request) Successful in 31s
WAI examples / WAI examples · the archive, the readiness check, the browser and Apple · macos (pull_request) Successful in 12m54s
wai-quantum OpenCL member / member · OpenCL GPU (macos) (pull_request) Successful in 23s
WAI conformance / cargo-class corpora · macos (pull_request) Successful in 20m0s
wai-quantum-qpu / credentials in the keychain (macos) (pull_request) Successful in 18s
wai-quantum for Python / python · macos (pull_request) Successful in 1m18s
wai-quantum matrix-extension member / member · matrix extension absent (macos) (pull_request) Successful in 11s
wai-quantum service / service · macos (pull_request) Successful in 47s
wai-quantum portable tensor program / tensor program · Metal and the arm64 CPU (macos) (pull_request) Successful in 17s
wai-quantum CPU vector units / member · vector unit absent (macos) (pull_request) Successful in 15s
wai-quantum neural-processor member / member · neural processor (macos) (pull_request) Successful in 9m24s
wai-quantum studio and desktop / desktop app · macos (pull_request) Successful in 2m45s
wai-quantum WebGPU member / member · browser WebGPU (macos) (pull_request) Successful in 1m45s
wai-quantum WebGPU member / member · Metal (macos) (pull_request) Successful in 2m34s
wai-sink-android native sink library / every ABI, the AAR, and the instrumented tests in a headless emulator · macos (pull_request) Successful in 7m3s
wai-sink-swift native sink package / libwai slices, desktop tests, simulator tests · macos (pull_request) Successful in 19m2s

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Transaction-Science/open-standards!517
No description provided.