feat: agent map data + framebuffer canvas screenshot#210
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First two of the three agreed agent-tooling building blocks (data first):
GetMapData(mapId)/ MCPget_map_data— compact, agent-oriented JSON projection of a loaded map: a walkability grid (.walkable /#solid /void; folds every visible layer's per-tilesolidflags + blocking placements), placements with names resolved through the canonicalresolvePlacementDefinition, spawn points and teleports with their targets. Pure engine service (services/agent-map-data.ts, spec'd + registered), works with no open scene, engine or visible window. It proved itself during its own validation: the grid immediately exposed two real gameplay bugs — the tree-house spawn point sat on the solid stool tile, and both kokiri door triggers sat on solid tiles the player can never enter (fixed in this PR: spawn → (5,7), triggers → the walkable mat row 67, return arrival → (76,68)).Framebuffer
canvasscreenshot —Screenshot('canvas')now reads the WebGL framebuffer instead ofGtk.WidgetPaintable: the engine widget hooksconnect_after('render')on the GLArea bridge (the only moment its framebuffer is bound — out-of-framereadPixelsreturns blanks, which the first two implementation attempts demonstrated), forces a frame viaqueue_render(), flips the rows and encodes viaGdkPixbuf. Chrome-free content that works while the window is occluded (mapped windows keep their frame clock); widget-snapshot stays as fallback (no engine / minimised).Screenshotis now async on the Control plane (precedent:StartSession). Known quirk noted in TODO: a faint offset ghost from FBO double-buffer residue.Bridge: new
get_map_datatool (+ guidance to prefer it over screenshots), updatedscreenshotdescription, pause-policy classification (GetMapData: read-only, pinned table extended). Both validated END-TO-END through the restarted MCP bridge against the live editor. Follow-ups in TODO.md:render_map(offscreen full-map PNG via the MapPreview Gsk pipeline) and an optional blockingopen_scene.