From 0ddeb5ba944bb886dcf6f40ad1d379d76ed5e9eb Mon Sep 17 00:00:00 2001 From: gilesb Date: Sun, 11 Jan 2026 18:22:36 +0000 Subject: [PATCH] Resolve registry asset/effect references when running recipes SOURCE nodes with config.asset now get content_hash from registry. EFFECT nodes with config.effect now get effect_hash from registry. Co-Authored-By: Claude Opus 4.5 --- app/routers/recipes.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/app/routers/recipes.py b/app/routers/recipes.py index 84eb714..1ba844f 100644 --- a/app/routers/recipes.py +++ b/app/routers/recipes.py @@ -273,17 +273,36 @@ async def run_recipe( dag_copy = json.loads(json.dumps(recipe_dag)) # Deep copy nodes = dag_copy.get("nodes", {}) + # Get registry for resolving asset/effect references + registry = recipe.get("registry", {}) + assets = registry.get("assets", {}) + effects = registry.get("effects", {}) + # Convert nodes from list to dict if needed, and transform to artdag format if isinstance(nodes, list): nodes_dict = {} for node in nodes: node_id = node.get("id") if node_id: + config = node.get("config", {}) + + # Resolve asset references for SOURCE nodes + if node.get("type") == "SOURCE" and "asset" in config: + asset_name = config["asset"] + if asset_name in assets: + config["content_hash"] = assets[asset_name].get("hash") + + # Resolve effect references for EFFECT nodes + if node.get("type") == "EFFECT" and "effect" in config: + effect_name = config["effect"] + if effect_name in effects: + config["effect_hash"] = effects[effect_name].get("hash") + # Transform to artdag format: type->node_type, id->node_id transformed = { "node_id": node_id, "node_type": node.get("type", "EFFECT"), - "config": node.get("config", {}), + "config": config, "inputs": node.get("inputs", []), "name": node.get("name"), } @@ -291,7 +310,7 @@ async def run_recipe( nodes = nodes_dict dag_copy["nodes"] = nodes - # Map input names to content hashes + # Map user-provided input names to content hashes (for variable inputs) for input_name, content_hash in req.inputs.items(): if input_name in nodes: node = nodes[input_name]