From c6fadea09010f525c6b688d6abbb2c04564f3679 Mon Sep 17 00:00:00 2001 From: gilesb Date: Sun, 11 Jan 2026 21:56:59 +0000 Subject: [PATCH] Save run output to user's media collection When a recipe run completes, save the output to the user's media with description and source tracking. Co-Authored-By: Claude Opus 4.5 --- legacy_tasks.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/legacy_tasks.py b/legacy_tasks.py index 5d6908c..f33d42c 100644 --- a/legacy_tasks.py +++ b/legacy_tasks.py @@ -399,6 +399,18 @@ def execute_dag(self, dag_json: str, run_id: str = None) -> dict: ipfs_cid=output_ipfs_cid, actor_id=actor_id, ) + + # Save output as media for the user + if actor_id: + await database.save_item_metadata( + content_hash=output_hash, + actor_id=actor_id, + item_type="media", + description=f"Output from recipe: {recipe_name}", + source_type="recipe", + source_note=f"run_id: {run_id}", + ) + # Clean up pending run if pending: await database.complete_pending_run(run_id)