Fixes from a code review of the Space.
Critical
- Router: credit came straight from the worker's own usage.completion_tokens, and a receipt is only a hash the worker computes itself, so one worker could mint any amount. Credit is now capped at the job's max_tokens and the answer's length, zero when the asker's IP is the worker's, and limited to 150,000 tokens per wallet per day.
- Copy button: the answer was embedded in a <script> block with json.dumps, so an answer containing </script> (from any worker or any model) could run script on the Space's origin and read the HF sign-in token. <, >, & and line separators are now escaped.
Important
- Cross-checks go to a different session, IP and wallet. A disagreement goes to a third worker, and only the odd one out is struck. Strikes are kept per wallet and IP, and copies earn credit only once they agree.
- Sign-in: messages are limited to 1 KB, nonce and verify requests to 10 per minute per IP, and each address to 3 open codes. The oldest …
Bonsai in this browser: drAIML Agreement, browseML engine (bankML on WebAssembly), evidence notes, bankML receipts; cross-origin isolation for threads