Developer-facing reference for aidedx: the stack, the local workflow, deployment, and a tour of the internal building blocks (eval set, alias tables, the libdedx WASM wrapper, and cross-origin isolation). This is the material a contributor needs; the README is the short, narrative introduction for everyone else.
- SvelteKit + Svelte 5 (runes only) + TypeScript (strict)
- Tailwind CSS v4
@sveltejs/adapter-static— prerendered SPA, deployed to GitHub Pages- Vitest for unit tests
- Node 26 in CI and deploy (
enginesstill allows>=24), package manager pnpm
pnpm install
pnpm dev # dev server
pnpm build # static production build → build/
pnpm preview # preview the production build
pnpm check # svelte-check + tsc typecheck
pnpm lint # ESLint
pnpm format # Prettier (write)
pnpm test # Vitest unit testsPushing to main triggers .github/workflows/deploy.yml, which builds the static site (with
BASE_PATH=/aidedx) and publishes it to GitHub Pages at https://aptg.github.io/aidedx/. CI
(.github/workflows/ci.yml) runs format, lint, typecheck, unit tests, and a build on every
push/PR.
eval/intents.jsonl is a hand-labeled set of ~110 natural-language queries
mapped to the shared QueryIntent schema. It is the project's
frozen regression suite — reused by the ASR/NLU spikes and the deterministic matcher — covering
direct/indirect/conversational phrasing, comparisons, unit variety, isotope and total-vs-per-nucleon
ambiguity, and inverse queries.
pnpm validate:eval # validate the dataset + print tag coverageSee eval/README.md for the schema, labeling conventions, and tag taxonomy.
The validator also runs in CI and as a Vitest test.
src/lib/aliases/ maps natural-language phrases ("PMMA", "carbon ions",
"lung tissue") to canonical libdedx materials and particles — the deterministic matcher's
accuracy backbone, also reusable by dedx_web's text search. resolveMaterial() /
resolveParticle() do exact → normalized → fuzzy matching and parse explicit isotopes
("carbon-13", "³He"). Tables are seeded from libdedx (via dedx_web) plus the periodic table and
shipped as both typed TS and JSON (static/aliases/).
pnpm generate:aliases # regenerate the JSON artifacts from the TS tablesSee docs/aliases.md for provenance and how to regenerate when libdedx updates.
src/lib/wasm/ is a thin, dependency-free TypeScript wrapper over the vendored
libdedx WebAssembly module (static/wasm/) — forward stopping power / CSDA
range, inverse lookups, and entity lists. It is lazy-loaded (getService()) so the shell ships zero
WASM until a query needs a number, and is kept clean of any aidedx-specific concept so it can later
be extracted as @aptg/libdedx-wasm (issue #1 §17).
src/lib/compute/ bridges the two worlds: computeIntent(intent, service)
resolves a QueryIntent's particle/material phrases via the
alias tables, converts energies to MeV/nucl (honoring the total-vs-per-nucleon assumption),
auto-selects a program, and fans out over the comparison dimension — returning real libdedx
numbers, never the LLM. The end-to-end smoke suite
(compute.smoke.test.ts) drives the actual WASM under
Node for the issue #1 §7 examples.
The binaries are prebuilt and checked in. See docs/wasm.md for the wrapper boundary,
provenance, and how to regenerate them.
In-browser ML backends need SharedArrayBuffer, which requires the page to be
cross-origin isolated
(COOP/COEP headers). GitHub Pages cannot set those headers, so the planned workaround is
coi-serviceworker. A documented,
intentionally-inert hook is left in src/app.html; the actual hosting/runtime decision is deferred
to Spike 3. See docs/threading-coop-coep.md.
aidedx is licensed GPL-3.0-or-later (see the README for why). Everything else it bundles or fetches at runtime is permissively licensed and compatible with GPL-3.0 (permissive code may be combined into a GPL-3.0 work; the reverse is not true):
| Component | License | Notes |
|---|---|---|
| Svelte, SvelteKit, Vite, TypeScript, Tailwind CSS, Vitest, ESLint, Prettier, Playwright | MIT | build/runtime tooling |
@huggingface/transformers (transformers.js) |
Apache-2.0 | in-browser ML runtime |
onnxruntime-web |
MIT | ONNX inference backend |
Whisper weights (onnx-community/whisper-small) |
MIT | speech-to-text; mirrored to our Cyfronet S3 bucket, see docs/model-hosting-cyfronet.md |
| Qwen2.5-0.5B-Instruct weights | Apache-2.0 | listed in src/lib/models/manifest.ts, not yet mirrored/enabled |
| Llama-3.2-1B-Instruct weights | Llama 3.2 Community License | custom, non-OSI license with an attribution ("Built with Llama") and acceptable-use-policy requirement; listed in the manifest but not yet mirrored/enabled |
@img/sharp-libvips (LGPL-3.0-or-later) is a transitive dependency of sharp, which is pulled in by
both @huggingface/transformers (a production dependency) and Playwright (dev/test tooling). It is
still never shipped to users, though: transformers.js's own browser build stubs sharp out entirely
as a Node-only module with no browser equivalent (verified in the built
build/_app/immutable/workers/asr.worker-*.js output — // ignore-modules:sharp), so it carries no
distribution obligation for aidedx itself.
docs/design.md— the original design & prototyping plan (issue #1): architecture, theQueryIntentschema, and phasing.docs/voice-pipeline-feasibility.md— audit of the ASR/NLU spikes' findings, with a revised architecture and measured numbers.docs/apple-silicon-benchmark.md— the same benchmarks re-run on Apple Silicon (M5): ASR latency, LLM-NLU-fallback viability, KV-cache reuse.docs/asr-model-comparison.md— Whisper model-size comparison for the ASR stage.docs/whisper-progress-feedback.md— download/inference progress UX for the Whisper stage.docs/tts-eval-audio.md— TTS-synthesized eval audio pilot (Kokoro-82M, then Qwen3-TTS), as an alternative to recording human speakers.docs/tts-eval-1000.md— the 1000-sample TTS eval-audio batch this pilot scaled up to.docs/athena-setup.md— Athena/PLGrid cluster environment setup, read before any GPU/Python work there (used by the TTS eval docs above).docs/nlu.md— the deterministic NLU matcher.docs/aliases.md— material/particle alias table provenance and regeneration.docs/wasm.md— the libdedx WASM wrapper boundary and how to rebuild the binaries.docs/answer-pipeline.md— matcher → compute → NLG → UI state, the layer after Whisper: unit conversion, error-message formatting, input validation.docs/local-model-cache.md— the Node-side.hf-cache/prefetch convention used by the benchmark scripts.docs/model-hosting-cyfronet.md— mirroring model weights to Cyfronet S3 instead of Hugging Face's CDN.docs/status-panel-design.md— the model-status header, download-consent, and clear-cache UX.docs/threading-coop-coep.md— cross-origin isolation,SharedArrayBuffer, and the static-host threading constraint.