# Bot King's Training Lab — vendored ML runtime (licence + provenance)

Two Google-authored libraries, both **Apache License 2.0** (full text in
`LICENSE` in this folder, from the TensorFlow.js project; the
`@teachablemachine/image` package carries the identical Apache-2.0 licence
per its published `package.json`).

| File | Package | Version | Why this version |
|---|---|---|---|
| `tf-1.3.1.min.js` | `@tensorflow/tfjs` | 1.3.1 | Pinned to match `@teachablemachine/image`'s declared peer dependency (`@tensorflow/tfjs: 1.3.1`) exactly — this is the combination Teachable Machine's own exported "website" code snippet loads, and the one its preprocessing/normalization code was built and tested against. |
| `tmimage-0.8.5.min.js` | `@teachablemachine/image` | 0.8.5 (latest) | The runtime that knows how to load a Teachable Machine image-model export (`model.json` + `metadata.json` + `weights.bin`) and apply the correct 224x224 resize/crop and normalization before handing frames to tfjs — reimplementing this by hand risks silently-wrong predictions, so the real Google runtime is vendored instead. |

Fetched 2026-07-16 from the public npm/jsDelivr CDN (`cdn.jsdelivr.net/npm/...`)
at build time; both files are self-hosted here and no runtime network request
is made to jsDelivr or npm by the shipped page.

This is intentionally a **separate, older tfjs build** from the
`vendor/tfjs/tf.min.js` (v3.29.1) already used elsewhere on the site
(`games/ai-lab.html`). The two never load on the same page, so there is no
version conflict — `games/training-lab.html` is the only page that loads
this folder's scripts.

## Honesty on verification
This is a real, unmodified Google ML runtime loading a real Teachable Machine
export — there is no simulated/fake inference path. Verified directly against
a real, live, publicly-shared Teachable Machine model
(`https://teachablemachine.withgoogle.com/models/r7aSS2SO/`, found via a
Teachable Machine tutorial): `model.json`, `model.weights.bin` and
`metadata.json` all fetched with HTTP 200, `tmImage.load()` resolved
successfully, and the page correctly advanced to "Model loaded! Now asking
for webcam access…" with zero console errors. Also verified: a garbage/bad
link is rejected client-side with an honest message before any network call,
and — because this sandboxed environment has no camera hardware and
`getUserMedia` can sit forever without resolving *or* rejecting when no
camera is available — a 15-second timeout race around `webcam.setup()` was
added and confirmed to fire correctly, re-enabling the Load button and
showing an honest "never got an answer to its camera request" message
instead of leaving the page stuck on a permanent spinner. The one thing that
cannot be verified from this environment is a live webcam capture against a
live human-trained model (no camera hardware here) — a parent/Gabriel
completing the real train-on-webcam step at teachablemachine.withgoogle.com
and pasting the resulting link back in is the actual verification path this
hall is designed for, and every step up to that point is now proven working
end to end with a real Google model.
