""" ImageLab v3 — ComfyUI custom node entrypoint. This is a clean-slate rebuild. For now it does two things: hash all model files on startup (in the background) and expose the hash cache over a small HTTP API. Functionality will be added back in pieces. The previous entrypoint is preserved as `__init__.py.legacy`, alongside the other legacy modules (`routes.py`, `workflows.py`, `imagelab_nodes.py`, `resources.py`, ...) — kept for reference, not loaded. """ import threading from . import hashing from . import api # No custom nodes yet — ComfyUI still expects these symbols to exist. NODE_CLASS_MAPPINGS = {} NODE_DISPLAY_NAME_MAPPINGS = {} # Register the HTTP API (synchronous — routes must exist before the server # finishes starting; this is just dict insertion, it does not block). api.setup_routes() def _hash_on_startup(): print("[ImageLab] Building model-hash index in the background ...") try: counts = hashing.build_index() if counts: print(f"[ImageLab] Hashed: {counts}") else: print("[ImageLab] No new models to hash") version, entries = hashing.get_snapshot() print(f"[ImageLab] Index ready: {len(entries)} models (version {version})") except Exception as e: print(f"[ImageLab] Error during startup hashing: {e}") threading.Thread(target=_hash_on_startup, daemon=True).start() print("[ImageLab] v3 loaded")