Polling bots have no external script running during practice mode,
so the poll would time out giving empty answers. Now overrides the
webhook URL to human.local so the browser UI handles challenges.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Allow huggingface.co in CSP connect-src (fixes Kokoro TTS model download)
- Add registerSW.js route (fixes PWA service worker 404)
- Add _resetPositions() safety after entrance (fixes invisible fighters)
- Fight end sequence works without canvas scene (KO/overlays/log always play)
- Pre-fight instructions in battle log for human players
- NIP-55 visibility sync and cleanup handlers
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Security:
- Move CREATOR_PUBKEY from hardcoded constant to BOTFIGHTS_CREATOR_PUBKEYS
env var. Shared isCreatorPubkey() in constants.ts used by auth, admin,
tournaments. Frontend checks authorization via API, not client-side.
Mobile fixes:
- Nostr signer: poll for window.nostr up to 3s (Amber injects late).
- TTS: auto-unlock AudioContext on first user interaction via
installAutoUnlock() on fight page mount.
UX:
- Add loading spinners to "I BUILD BOTS" and "I FIGHT MYSELF" buttons.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Expand all 5 creative answer pools from 5-10 to 25-30 entries each
- Fix factual wrong answers to pick from challenge's own wrong choices
instead of random non-sequiturs like "banana" and "purple?"
- Reduce bad answer rate: 25% → 2.5% at elo 1200, 0% at elo 1300+
- Improve BAD_ANSWERS and WRONG_FACTUAL to be funny when they do appear
- 90%+ of all mock answers are now good attempts that make sense
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix invisible characters in human mode: init live scene BEFORE starting
challenge polling so entrance plays before first question appears
- Cap creative writing timer to 10s for multiple choice (just tapping buttons)
- Fix TTS reliability: precache priority phrases (Round 1-7, Fight!, K.O.)
all at once instead of in slow batches; prevent duplicate precache runs
- Add 10 vibe-coded narrations (~20% chance): "I was vibe coded into existence"
- Add 15 sweary narrations (~30% chance): raw unhinged fight commentary
- Add sweary draw and retro narrations
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace insecure raw-pubkey auth with cryptographic NIP-98 signed
requests and server-issued JWT sessions. Logout now fully clears
all state including nsec. Add yellow "Use Nostr Signer" button
for Amber/NIP-07 remote signers.
- Server: JWT middleware (HMAC-SHA256, 24h expiry), NIP-98 verification
- Server: POST /api/auth/nostr/session endpoint
- Frontend: NIP-98 token builder + authFetch wrapper with JWT Bearer
- Frontend: All authenticated API calls use authFetch
- Security: logout clears JWT, pubkey, bot, nsec, and profile pic
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add Practice button to BotProfilePage for quick sparring
- Fix rate limiter bug: all rateLimit() instances shared one counter map,
causing global and per-route limits to corrupt each other. Each limiter
now gets its own isolated map.
- Replace 8-digit hex colors (#ffd70066) with rgba() in sprite rendering
for mobile browser compatibility (iOS Safari renders them as black boxes)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Mobile nav menu now overlays content (absolute positioning) instead of
pushing it down
- Speech bubbles stay visible for minimum 400ms even when TTS resolves
instantly or fails
- kokoroPlayCached checks audio cache and loads static files even when
Kokoro worker hasn't loaded — fixes TTS not playing on production
- CORS_ORIGIN env now supports comma-separated origins
- Rename "VIDEO REPLAY" to play icon + "REPLAY"
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Track active fight IDs per bot in orchestrator (Set → Map)
- Return fightId in "already in fight" error responses (409)
- Frontend shows "REJOIN FIGHT" link instead of generic error
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Benchmarks the scoring pipeline (challenge → response → score → elo → tier)
without I/O. Currently achieves ~8500 fights/sec.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Bots answer via webhook and don't need multiple choice options.
Add forHuman parameter to pickChallenge, update tests to cover both modes.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Migrate all server modules to use the centralized logger (lib/logger.ts)
instead of raw console calls. Lint warnings reduced from 74 to 25.
Remaining warnings are only no-floating-promises in game engine code.
Files updated: orchestrator.ts, ranked-queue.ts, human-responses.ts,
payments.ts, fight-loop.ts, app.ts, routes/payments.ts
Files suppressed: logger.ts, fight-loop-cli.ts, migrate.ts (legitimate console use)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Simulates 1000 full fights with HP tracking (200 HP start, 7-10 rounds)
to verify average fight length (5-10 rounds) and KO rate (20-80%).
Validates the balance between damage output and HP pool.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Two new regression tests:
- 10,000 fights with varied elos, personalities, and round counts (50k+ rounds) — zero crashes
- All 16 challenge types tested with 5 response scenarios each (normal, timeout, error, double-timeout, arena+combo)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Verify equal-elo fights produce 45-55% win rates for each side
- Verify elo difference correlates with win probability
- Relax narration variety threshold from 80% to 70% (borderline flaky)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move fightEvents.cleanup(fightId) to finally block to ensure
cleanup runs even if post-fight operations (bets, payouts) fail.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Creative challenges now have auto-generated MC choices with correct
answers. Mock bad answers can be empty at any elo, so test checks
proportion instead of requiring all non-empty.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The bets schema was defined in schema.ts but never created in
startup.ts, causing crash on index creation referencing bets table.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Creative challenges (roast_battle, creative_writing, meme_war,
code_golf, wrestling_match) now auto-generate multiple choice options
from per-type response pools: 1 good answer + 3 weaker distractors.
The free text input UI is commented out but preserved for future use.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Verifies prompt pool has 200+ bitcoin, 100+ conspiracy, 100+ PC,
and 1000+ bot_coding themed prompts across all challenge types.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
25% chance of themed narration per round, adding variety with
Bitcoin sats/mining/HODL humor, conspiracy classified/debunked
humor, and PC cancel/trigger culture humor.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fresh roasts, creative writing, and memes about AI coding assistants,
vibe coding, startup pivots, and framework churn.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix fight replay showing empty scene: validate rounds before playing,
retry loading fight data up to 5 times when rounds are missing
- Add COOP/COEP headers to production server for SharedArrayBuffer
(required by Kokoro TTS WASM threading on mobile)
- Add blob: to scriptSrc/workerSrc CSP for Web Worker support
- Fix mobile character cutoff: raise ground line to 0.82, add
MOBILE_SCALE_CAP (0.55) so fighters never shrink too small
- Add ₿ bitcoin chest badge to all fighter sprites (scales with tier)
- Add sats coin stack on bot profile page proportional to satsWon
- Seed dev tournament with 8 mock bots on startup (dev mode only)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Satirical and irreverent — cancel culture, DEI absurdity, trigger
warnings, virtue signaling, safe spaces. Mocking the absurdity,
never punching down.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Satirical and fun conspiracy culture humor — MK-Ultra, Area 51,
flat earth, tinfoil hats, Bigfoot, UFOs, surveillance. Never endorsing.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
10 prompts per type covering Bitcoin history, mining, Lightning,
privacy, culture, memes, riddles, and technical knowledge.
Total prompts: 1,485 (253 Bitcoin-themed).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
93 bitcoin, 2 conspiracy, 1 pc_culture, 1,229 bot_coding.
Most existing prompts are tech/general knowledge (bot_coding).
Theme-aware pickChallenge now has data to filter on.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Hash rate question: added ×10^20 notation to answers array
- Phishing question: added correct MC choice text to answers array
- New tests: self-match, case-insensitive, MC correctness validation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Round 1-2 picks easy prompts, 3-4 medium, 5+ hard (when tagged).
Graceful fallback to any prompt when no difficulty-tagged prompts exist.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add dedicated narrations for: magic_duel, sports_showdown, vehicle_mayhem,
nature_clash, animal_kingdom, hack_battle (6 per type, 36 new narrations).
All 16 challenge types now have themed narrations — no generic fallback needed.
Add narration variety test verifying >1 unique narration per type.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add GitHub Actions CI: test, typecheck, lint on push/PR to main
- Add fight lifecycle integration tests: full pipeline, ELO advantage,
combo scaling, type exhaustion, answer verification (7 tests)
- Kaplay already lazy-loaded via route-level code splitting
- Total: 135 tests across 7 test files
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sets up ESLint 10 flat config with @typescript-eslint/no-floating-promises (error)
and no-console (warn, allow warn/error). Fixes all floating promise errors in
server routes, orchestrator reader cleanup, and frontend composables with void operator.
Game engine files get warning-level for intentional fire-and-forget async.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Covers plan section 4.1: pickChallenge 70/30 distribution, pickRankedChallenge never returns choices,
True/False auto-generation, special characters and long answers, all 16 challenge types produce valid
mock responses, and timeout/error answer verification. 113 → 125 tests.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
TTS audioCache now tracks lastAccess timestamp per entry and evicts
the least-recently-used entry when full (was FIFO, deleting commonly
used phrases). Adds 6 new database indexes for bets, bot type/active
filtering, payment status lookups, and tournament entries.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>