"""Shared render-check-repair logic for visual answers, used by lfm3_deliberate.solve_visual. (The same rules as scripts/visual_repair.py, which produced the measured numbers.) problems(rep, animated, src, kind, hints) -> (weighted badness, feedback lines) from a render.py report; feedback(kind, lines) -> the repair turn text; fix_importmap from vis_autofix (deterministic, no model call). """ import re from vis_autofix import IMPORT_MAP, fix_importmap # noqa: F401 (re-exported for callers) # browser error -> the fix a web developer would apply (general knowledge, never a solution of a particular task) HINTS = [ (r'Failed to resolve module specifier "three', "A module imports the bare name 'three' (three.js addons do this " f"too). Put the import map in
, before any module script: {IMPORT_MAP}, then write " "import * as THREE from 'three'; and import addons like import { OrbitControls } from " "'three/addons/controls/OrbitControls.js';"), (r"THREE is not defined", "three.js is not a global variable. Add the import map " f"{IMPORT_MAP} and, inside