McRogueFace/tests/api
John McCardle ff46043023 Add Game-to-API Bridge for external client integration
Implements a general-purpose HTTP API that exposes McRogueFace games
to external clients (LLMs, accessibility tools, Twitch integrations,
testing harnesses).

API endpoints:
- GET /scene - Full scene graph with all UI elements
- GET /affordances - Interactive elements with semantic labels
- GET /screenshot - PNG screenshot (binary or base64)
- GET /metadata - Game metadata for LLM context
- GET /wait - Long-poll for state changes
- POST /input - Inject clicks, keys, or affordance clicks

Key features:
- Automatic affordance detection from Frame+Caption+on_click patterns
- Label extraction from caption text with fallback to element.name
- Thread-safe scene access via mcrfpy.lock()
- Fuzzy label matching for click_affordance
- Full input injection via mcrfpy.automation

Usage: from api import start_server; start_server(8765)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 23:08:26 -05:00
..
__init__.py Add Game-to-API Bridge for external client integration 2026-01-29 23:08:26 -05:00
run_api_server.py Add Game-to-API Bridge for external client integration 2026-01-29 23:08:26 -05:00
test_api_basic.py Add Game-to-API Bridge for external client integration 2026-01-29 23:08:26 -05:00
test_api_windowed.py Add Game-to-API Bridge for external client integration 2026-01-29 23:08:26 -05:00