Add artifacts to run detail view

Build artifacts list from run output_hash and detect media type
for display in the artifacts tab.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gilesb
2026-01-11 22:08:06 +00:00
parent ccf28bd351
commit 145c69f21b

View File

@@ -140,10 +140,30 @@ async def get_run(
except Exception as e:
logger.warning(f"Failed to load recipe for plan: {e}")
# Build artifacts list from output and inputs
artifacts = []
if run.get("output_hash"):
# Detect media type
output_hash = run["output_hash"]
media_type = None
try:
cache_path = get_cache_manager().get_path(output_hash)
if cache_path and cache_path.exists():
import mimetypes
media_type, _ = mimetypes.guess_type(str(cache_path))
except Exception:
pass
artifacts.append({
"hash": output_hash,
"step_name": "Output",
"media_type": media_type or "application/octet-stream",
})
templates = get_templates(request)
return render(templates, "runs/detail.html", request,
run=run,
plan=plan,
artifacts=artifacts,
active_tab="runs",
)