Spaces:
Runtime error
Runtime error
Commit History
-
feat(block17): $CLAY simulated economy + single-match wagering
- ClayBalance + ClayTransaction models (integer cents) + Alembic migration 0019 - ClayLedger abstract interface + SqliteClayLedger concrete impl (get_ledger singleton) - Signup hook grants 100 $CLAY starting grant; idempotent backfill script - POST /agents/{id}/play-kenji: stake input, debit on match create - Post-match processor _settle_wager: win=2x, draw/abandoned=refund, loss=audit marker - Nav balance display (Jinja2 global) + /me/clay-history paginated history - Wager banner in play.html (live outcome update) + wager section in _summary_body.html - 21 passing tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>d9ca024
-
hf: adapt Dockerfile for HF Spaces, add entrypoint + migrate script
- Port changed 8000 → 7860 (HF Spaces app_port requirement) - ENTRYPOINT set to entrypoint.sh (runs migrations before uvicorn) - Copy alembic/ + alembic.ini into image (was missing — needed for migrations) - Pre-warm sentence-transformers/all-MiniLM-L6-v2 at build time alongside Maia-2 - DATABASE_URL default → sqlite:////data/metropolis_chess.db (HF persistent /data volume) - REDIS_URL default cleared (no Redis on HF Spaces; in-process fallback activates) - HF_HOME=/app/.cache/hf unified for maia2 + sentence-transformers caches - /app/logs + /data created with chmod 777 so uid 1000 (HF runtime user) can write - entrypoint.sh: runs scripts/migrate.py then exec uvicorn - scripts/migrate.py: fresh DB → create_all + alembic stamp head; existing DB → alembic upgrade head. Avoids the 0001 no-op / 0002 batch-alter failure that occurs when alembic upgrade head runs against an empty SQLite file. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>7fdba7e
-
Phase 4.0–4.3: demo prep — auth, Elo fairness, rooms, lobbies, conversational entry, evolution
Big stretch of demo-prep work, shipped across seven sub-phases under a "zero-button, immersive" design direction that emerged mid-stretch. Phase 4.0 — foundations * 4.0a email+username+password login (Argon2, signup/login/forgot/reset, per-user settings, legacy-player compat). Migration 0007. * 4.0b opponent-ACPL-weighted Elo gain + consecutive-easy-wins soft cap + `matches.is_private` flag that zeroes Elo (anti-farm guardrail). Migration 0008. * 4.0c MockEngine was shuffling knights/bishops in the opening due to a naive alphabetical-first UCI pick — now filters direct reversals of recent own moves + 3-fold inducing moves. Phase 4.1 — character rooms Each grandmaster gets a themed room (palette CSS-var overrides, ambient audio track, backdrop image, emotion-clip mapping). `app/characters/rooms.py` + base.html/body[data-theme]/inline-style pipe. Ambient-audio JS with mute toggle + localStorage persistence. Viktor emoti…7bad702
-
Patch Pass 2 Item 6: Kenji's opening repertoire + refresh script
Real play: Kenji (aggression 10, "pure tactics", speed-chess streamer bio) was playing solid openings because his opening prefs were a mix of mainline stuff. On the board he felt conservative — the opposite of his character sheet. Kenji's opening_preferences now: King's Gambit, Danish Gambit, Evans Gambit, Scotch Gambit, Latvian Gambit, Vienna Gambit. All sharp gambits — exactly what a teenage Twitch blitz streamer who drops out of Waseda for bullet tournaments would play. Added Vienna Gambit (C25) and Scotch Gambit (C44) to the curated openings list — they didn't exist previously. Because `seed_presets` is idempotent by `preset_key` and skips existing rows, tweaks to a PresetSpec don't flow to DBs that already seeded. Added `scripts/refresh_preset_openings.py` — a one-time escape hatch that overwrites `opening_preferences` on existing preset rows from the current spec list. Memories, Elo state, backstory, etc. are left alone. README documents the usage. Co-Authored-By: Claude Opus…8377ce8 -
hotfix: test_live_match player needs a username
Phase 3a made Player.username NOT NULL + unique but the live-match demo script's Player(display_name='LiveDemo') was never updated. Every live test run crashed on IntegrityError at player insert. One-line fix: generate a guest_* username the same way the normal login path does. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>9005706 -
Phase 3a: username login, character ownership, content rating, Alembic
Ships Phase 3a (social/identity foundation) on top of the Phase 2b agent + post-match work. The 2b source files were tracked alongside this commit because they had not been previously committed and the 3a code imports from them. Phase 3a changes ---------------- Data model - Player: new `username` (unique, 3-24 chars, [a-z0-9_], NOT NULL) and `max_content_rating` (family/mature/unrestricted, default family). - Character: new `owner_id` (FK players.id, NULL = system/preset), `visibility` (public/private) and `content_rating`. - Preset ratings applied: Viktor + Kenji = mature; Margot + Archibald = family. Auth + routes - `app/auth.py`: cookie-based require_player / get_optional_player dependencies, NotAuthenticated exception (→ 303 redirect for HTML, → 401 JSON for /api/). Username validation + guest-name generator. - `GET/POST /login` — claim a username. Existing guest_* cookies can rename into a real username (preserves matches + memories). - `GET /logout`, `GET /api/me`,…06fed2f
-
Phase 2a hotfix: live gameplay works end-to-end
Fixes reported by Docker smoke test: 1. Maia-2 undeclared transitive deps. Upstream's `install_requires` is incomplete. Audited by running the model in a container: - Needed pyzstd (weight decompression) and gdown (weight downloads from Google Drive). Added to the [engine] extra + Dockerfile. - Corrected the inference_each unpack — returns (move_probs, win_prob), not a 3-tuple (verified via inspect.signature against maia2 v0.x). 2. Maia-2 writes weights to /app/maia2_models/ (hardcoded upstream), not HF_HOME. Pointed the maia2-cache compose volume at the right path so weights persist across container restarts. MAIA2_CACHE_DIR kept as a forward-looking env var. 3. Chessboard.js pieces. Bundled the wikipedia piece set under app/web/static/img/chesspieces/wikipedia/ (12 PNGs) and mounted /static via StaticFiles in app.main. play.html references the local path; no CDN dependency. 4. UI banner polish. Moved the error surface to a prominent top-of-pag…d170397 -
Phase 2a infra + tests + docs
- Dockerfile: python:3.12-slim, apt-installs Stockfish, pip-installs torch (CPU wheels) + maia2, pre-warms the Maia-2 weight cache at build time. Runtime env points STOCKFISH_PATH, MAIA2_CACHE_DIR, and REDIS_URL at the compose service. - docker-compose.yml: app + redis with named volumes for DB, logs, Maia cache, and redis AOF. - scripts/setup_engines.py: idempotent probe, safe to re-run on boot, never fails the build (weights download on first use if missing). - Tests: * test_director.py — effective-Elo math, clamp, beast-mode rules, Stockfish fallback, time-budget interaction between patience and aggression * test_mood.py — slider→mood mapping, trash_talk→engagement bias, smoothing alpha/τ consistency, convergence * test_elo_ratchet.py — per-match cap, floor/max clamp, non-adaptive no-op, floor raise after 3-match window * test_board_abstraction.py — starting-position material, central pawn structure, pin/hanging detection, endgame phase, eval pr…f73b724