# Maia 1500 Lc0 Browser Runtime Build Notes

This package uses public `@lichess-org/zerofish@0.0.40` browser runtime assets
for the Lc0 WASM engine and public `CSSLab/maia-chess` Maia 1500 weights.

## Reproducing The Distributed Files

1. Download the zerofish package:

   ```bash
   curl -L -o zerofish-0.0.40.tgz \
     https://registry.npmjs.org/@lichess-org/zerofish/-/zerofish-0.0.40.tgz
   shasum -a 256 zerofish-0.0.40.tgz
   ```

   Expected SHA-256:

   ```txt
   3f762c90403aa0b2b76ece227b242cde6a4e42482246a2545df02283861c1d9d
   ```

2. Extract the package and copy:

   ```txt
   package/dist/zerofishEngine.js -> runtime/maia-1500/lc0-engine.js
   package/dist/zerofishEngine.wasm -> runtime/maia-1500/lc0.wasm
   package/LICENSE -> LICENSE and runtime/maia-1500/LICENSE.txt
   ```

3. Download Maia 1500 weights:

   ```bash
   curl -L -o runtime/maia-1500/maia-1500.pb.gz \
     https://raw.githubusercontent.com/CSSLab/maia-chess/749204cf5979ce7f8b0412e804a4ee7c83c49ff8/maia_weights/maia-1500.pb.gz
   shasum -a 256 runtime/maia-1500/maia-1500.pb.gz
   ```

   Expected SHA-256:

   ```txt
   35ab6f20421d59e1df3b17c5a5016947af4c6761368ef84044a9a9c7619a9a00
   ```

   Expected git blob SHA:

   ```txt
   651551e2603c3efba9c6ded3b87da302c40722fb
   ```

4. Keep `lc0.js`, `manifest.json`, `LICENSE.txt`,
   `LICENSE.GPL-3.0.txt`, `NOTICE.txt`, `SOURCE.txt`, `BUILD.md`,
   and `CHECKSUMS.sha256` available with the runtime.

5. Regenerate manifests, notices, source files, build notes, and checksums:

   ```bash
   node scripts/generate-runtime-files.mjs
   ```

6. Run:

   ```bash
   npm run validate
   ```

## Building zerofish From Source

The zerofish source commit used by the package is:

```txt
c2934bb579d8a167ae99297584b5ba15e3583664
```

The source tree includes `build.sh`, `wasm/fetchSources.sh`,
`wasm/lc0.patch`, `wasm/stockfish.patch`, and glue sources. The build script
fetches:

- Lc0 tag `v0.29.0`
- Eigen tag `3.3.7`
- Stockfish ref `SF_classical`

The script can use a local Emscripten installation or Docker image
`emscripten/emsdk:latest`. Because that Docker image tag is moving, a byte-for-
byte rebuild is not claimed here. The distributed artifacts are instead pinned
to the public npm tarball and its SHA-256 above.
