Add zero-latency MCP pause and clean playthrough replay - #32
Conversation
Runwave's CLI runs its own VLM loop and produces a playtest video. This adds an MCP surface where the connected agent is the player instead: observe a frame, send a timed input sequence, observe the next frame. The server embeds the controller rather than driving the daemon. That is possible because BrowserSession and runStep already take their dependencies as arguments, and it avoids the daemon's session files, unauthenticated loopback port, process.exit on stop, and cwd captured at module load. The normalize/timeline/execute chain, session factory, state reader, and grid overlay are reused unchanged. Recording is out of scope for interactive play, so Chromium runs headless and the gstreamer, PulseAudio, and Xvfb requirements are gone. Adaptations for an agent player rather than a playtest bot: - Frames return as MCP image blocks, downscaled by default. A 1280x720 PNG is ~1200 tokens against ~300 at half scale, which dominates cost over a long navigation. zoom covers detail without a full frame. - act reports whether the frame changed. A byte-identical frame means the input did not reach the game, not that the game ignored it. - Grid overlay off by default: it enlarges the PNG with a label margin, desyncing image coordinates from input coordinates. The offset is reported when it is on. - Grid cells resolve to the cell centre via a new opt-in markGridSampleMode. Playtest scatter varies footage but misses precise targets and makes runs unreproducible; the default is unchanged. - Per-turn state drops the WebGL probe and keeps the largest canvas as the game area. - Calls serialize per session, since one page and one step counter mean concurrent calls would interleave keypresses. - Signal handlers and a 30 minute idle timeout close detached Chromium and game processes. Tests: 12 unit tests, plus an integration test that drives real headless Chromium against a fixture game and skips when Chromium cannot launch. The integration path is unverified here: this machine is missing libnss3/libnspr4, so it has only been exercised via unit tests so far. Co-Authored-By: Claude <noreply@anthropic.com>
TerminalBench Bot CommandsRun tasks: Check: Debug: Full Check: Grok Trace Run: Trace Run: Re-verify (re-score existing agent attempts against updated tests): Harbor format checker: Offline-search reviewer: Online-search reviewer: Sapphire format checker: Multiturn format checker: Multiturn retained scoring: For detailed parameter descriptions, run Job Management: Review: Remove default flags: Use Aliases: Get help: |
Summary
pause_gameoverride plus explicitresume_gameFindings addressed
Verification
npm run test:allDISPLAYis unavailableThis is a follow-up to #30 and is based on its MCP commit. Until #30 merges, GitHub will also display that prerequisite commit in this PR; the implementation added here is commit
814d832.