open-standards/aac/aac-rs/README.md
Transaction Science 3e88f9fbc9 feat(aac sentence helper): whole sentences and replies, suggested on the device
The sentence helper is an optional download (Settings → Sentence helper):
Gemma 4 E2B in Google's web build, run by Google's LiteRT-LM web runtime on
the graphics chip, in a worker. ✨ beside the message turns the words chosen
into three sentences, fitting what the partner said if it was typed in, or
suggests four replies when no words are chosen yet. The suggestions take the
word predictions' place, at their height, so no cell moves (SPEC §3); the
person chooses one and speaks it. Nothing is spoken by itself, and nothing
typed leaves the device.

- ai_helper.rs: the catalogue (aac-ai-index/1), prompts, whether a device can
  run it (a WebGPU hardware adapter, never the processor), download, continue,
  remove and re-check, and suggestions that a later request supersedes. The
  model's parts (64 MiB, SHA-256 checked) and the one runtime build this
  browser runs live in the model store; the worker streams the parts from
  there into GPU memory.
- third_party/litert-lm: @litert-lm/core 0.17.1 vendored and pinned (npm
  integrity, each file's size and SHA-256), with our worker bundled by esbuild
  0.28.2; the runtime's CDN default is emptied.
- tools/ai: build_ai.py (the pinned model → parts and catalogue),
  check_packs.py, languages.json (English, Spanish, German and Hindi ready;
  Swahili not yet), and eval/: the 20 exchanges, a harness that runs the
  app's own prompts (a test keeps them word for word), and the judged answers.
- Measured: Chrome on an M5 Max, 0.4-0.7 s an answer. A real iPad Air (M3) in
  Safari 27: 101 s to download and check 2 GB, about 80 s for the first start,
  5.9 s for later starts, 0.8-1.4 s an answer.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-01 06:52:48 -04:00

3.2 KiB
Raw Permalink Blame History

aac-rs — the AAC reference implementation

Rust reference for the AAC open standard. Apache-2.0.

Crate What it is
access-core The shared access kernel: access methods, switch scanning with its response calibration (SPEC §5.2), dwell with two-way proposals (§5.3), gaze estimation, voice. Four dependencies (serde, serde_json, thiserror, web-time).
aac-core The engine: boards, symbols, vocabulary, motor planning, prediction, i18n with each language's core status (§4.1), the cascade, interchange.
aac-web Express, the reference communication app (Leptos → WASM, offline-first PWA). Live at aac.transaction.science.
aac-conformance The harness: C1–C7 against the published vectors in ../conformance/v1/.

Test and conform

cargo test --workspace
cargo run -p aac-conformance --bin aac-conformance     # C1–C7; any FAIL exits non-zero
cargo run -p aac-conformance --bin gen-vectors -- ../conformance/v1   # regenerate C5/C6 vectors

Build the app as a static site

bash prerender-static.sh        # → target/site/, ready to rsync; deploy with no_cache_bust

The script builds with the wasm-bindgen CLI version the crate pins (installing a private copy if the machine's differs), prerenders the SSR shell, content-hashes pkg/, and writes a service worker that precaches the shell and every file it loads, so the installed app opens with no network.

Two optional downloads ship beside the app, each built outside git and checked against a catalogue committed here. Each is offered to the person, never fetched by itself, and runs on their device:

  • Better voices (tools/voices/): neural text-to-speech.
  • The sentence helper (tools/ai/): an on-device language model that turns a few chosen words into whole sentences, and suggests replies. It runs on the graphics chip only, and only in the languages it was tested in.

Set AAC_VOICES=none or AAC_AI=none to build without them.

Host it under your own site

Express reads four build-time variables (set them for both the cargo-leptos build and the prerender):

Variable Default Use
AAC_BASE_PATH "" Mount path, e.g. /app. Also set LEPTOS_SITE_PKG_DIR=app/pkg for the prerender.
AAC_SW_URL /sw.js The service worker to register (a host usually runs one for its whole site).
AAC_APP_TITLE AAC — aac.transaction.science The document title.
AAC_HIDE_ENERGY unset Set to hide the energy meter.

aac.aurasense.ai builds it this way at /app (build-app.sh).

Two rules the app keeps

  • The first frame is the same on the server and in the browser. Saved state is restored only after hydration, behind a brief starting screen. Reading it earlier made a returning user's first frame differ from the prerendered page, and hydration aborted.
  • Timing belongs to the person (SPEC §5.1). Settings → Timing sets scan speed and dwell, shows proposals from the person's own responses to accept or decline, and adjusts automatically only if they turn that on.