mirror of
https://github.com/storytold/figcraft.git
synced 2026-11-29 01:34:37 +01:00
An agent building a page can't see whether it matches the design. `inspect.compare` and the MCP tool `compare_design` take a capture the agent's own browser tools made and compare it with a frame, on this computer. A browser's text and antialiasing never match pixel for pixel, so the answer isn't one score: it is the layers that differ, each on the deepest layer it belongs to and largest first, as a position difference (with its offset), a colour difference (expected and actual) or a content difference. Text is held to twice the tolerance. A capture at 2x is the same design: the frame's width sets the density. Explicit targets are validated, and one frame is compared at a time. Parameters of the wrong type are refused, and so are a path and data together. The capture is size-checked before it is decoded, the comparison scale is bounded by the larger of the frame and the capture, the layer walk is iterative and capped (`truncated` says so), and only the 100 differences listed are searched for a move.