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]