Commit Graph
3 Commits
Author SHA1 Message Date
ai-chess 51e63a8c7a feat(docker): bake claude+codex CLI + auth into image, non-root user
Dockerfile additions:
- Node 20 (NodeSource repo) + @anthropic-ai/claude-code@2.1.141 via npm.
- codex 0.130.0 musl tarball from github releases, dropped into
  /usr/local/bin/codex.
- jq + xz-utils + gnupg apt packages.
- Symlink /usr/games/stockfish → /usr/local/bin/stockfish (Debian
  puts it under /usr/games which isn't on the default PATH).
- Non-root user 'chess' (uid 1000) because claude-code refuses to run
  with --dangerously-skip-permissions as root; HOME=/home/chess.
- Pre-seeded /home/chess/.claude/settings.json + /home/chess/.claude.json:
  - hasCompletedOnboarding=true / lastOnboardingVersion='2.1.141'
  - projects['/app'].hasTrustDialogAccepted=true (mirrors the user's
    claude-trust-current-dir helper, but baked since cwd is always /app)
  - permissions.defaultMode='bypassPermissions'
  - skipDangerousModePermissionPrompt=true
  Without these, every fresh tmux pane hangs on the theme picker, then
  the workspace-trust dialog, never reaching its first MCP call.

docker-compose.yml:
- ANTHROPIC_BASE_URL + ANTHROPIC_AUTH_TOKEN env (loaded from /opt/chessai/.env).
- ./secrets/codex mounted read-only at /home/chess/.codex so the user's
  cliproxyapi-flavored codex config + auth.json travel with the deploy
  but stay outside the image layers.

deploy/codex/config.toml:
- Minimal codex config (cliproxyapi provider, gpt-5.5 xhigh fast,
  chess MCP url placeholder overridden per-side by pane-agent.sh).

scripts/pane-agent.sh:
- Use CLAUDE_BIN / CODEX_BIN from PATH (mac vs linux dynamics);
  the inline -c mcp_servers.chess.url override removes the need for
  'codex mcp add/remove' that polluted ~/.codex/config.toml on Mac runs.

Verified end-to-end on chess.danosito.com: AI-vs-AI game starts,
claude (white) inside the container makes the first move with a
toxic russian comment, MCP HTTP roundtrip works.
2026-05-15 02:05:18 +03:00
ai-chess ab38cda1bd feat(menu): unified home screen + ai-vs-ai/play split + human mode
Routes:
- GET /        → menu.html (new home/menu).
- GET /ai-vs-ai → old index.html (AI-vs-AI live game).
- GET /play    → same index.html; app.js detects the human side from
  bindings and enables chessground move input on that side only.
- GET /games   → unchanged.

Backend:
- coordinator: 'human' is now an allowed agent type alongside claude/codex.
  start_new_game accepts overrides[side].agent = 'human'. _send_first /
  _send_turn / watchdog skip human sides.
- POST /api/human-move: humans submit moves from the browser (UCI/SAN
  + optional comment); rejected if it's not their turn or side isn't human.
- /api/options now also returns 'all_agents' = AI agents + 'human' for the
  human-vs-AI configurator.
- pane-agent.sh: when binding agent is 'human', the pane just prints a
  note and sleeps — no claude/codex is launched for that side.

Frontend menu (new public/menu.{html,css,js}):
- 'underground tournament' aesthetic: Major Mono Display title, JetBrains
  Mono body (Google Fonts), warm gold (#c0a060) / crimson (#c04040)
  accents, subtle film-grain overlay.
- Three big mode cards: 01 AI×AI, 02 HUMAN×AI, 03 GAMES·STATS.
- Inline configurator below the cards: WHITE / VS / BLACK columns with
  agent / model / persona selects, persona description preview, swap +
  randomize tools, abort-current warning that links to /api/abort-game.
- Start button routes to /ai-vs-ai or /play depending on whether a human
  side was picked. Enter submits.
- HUD strip with tmux / stockfish / games-played counters.

app.js changes:
- Chessground constructed with viewOnly toggling; renderBoard rebuilds
  movable.color + dests = legal moves at the live FEN from chess.js for
  the human's turn only; board is read-only when scrubbing history,
  during the AI's turn, or in AI-vs-AI.
- humanSide() helper reads bindings; orientation auto-flips when the
  human plays black.
2026-05-15 01:10:47 +03:00
ai-chess 266ff07a93 feat(scripts): pane-agent.sh launches claude/codex per side 2026-05-14 23:29:02 +03:00