diff --git a/server.py b/server.py
index e27c27e..ef15f0b 100644
--- a/server.py
+++ b/server.py
@@ -377,13 +377,7 @@ def detect_media_type(cache_path: Path) -> str:
return "unknown"
-UI_HTML = """
-
-
-
-
+
+"""
+
+ # Media row
+ has_input = run.inputs and (CACHE_DIR / run.inputs[0]).exists()
+ has_output = run.status == "completed" and run.output_hash and (CACHE_DIR / run.output_hash).exists()
+
+ if has_input or has_output:
+ html += '
'
+
+ # Provenance section
+ html += f'''
+
+
Provenance
+
+
+
Input(s)
+
+ '''
+ for inp in run.inputs:
+ html += f'
{inp}'
+ html += f'''
+
+
+ '''
+
+ if run.output_hash:
+ html += f'''
+
+ '''
+
+ html += f'''
+
+
Run ID
+
{run.run_id}
+
+
+
Created
+
{run.created_at}
+
+ '''
+
+ if run.completed_at:
+ html += f'''
+
+
Completed
+
{run.completed_at}
+
+ '''
+
+ if run.error:
+ html += f'''
+
+ '''
+
+ html += '''
+
+
+
+
+'''
+ return html
+
+
@app.get("/ui/run/{run_id}", response_class=HTMLResponse)
-async def ui_run_detail(run_id: str):
+async def ui_run_partial(run_id: str):
"""HTMX partial: single run (for polling updates)."""
run = load_run(run_id)
if not run: