Add IPFS link to recipe S-expression display

- Show ipfs://... link next to recipe S-expression header
- Links to ipfs.io gateway for viewing the raw S-expression

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gilesb
2026-01-12 00:36:14 +00:00
parent b686ce75f8
commit 3599f3779b
2 changed files with 14 additions and 2 deletions

View File

@@ -179,6 +179,7 @@ async def get_run(
# Try to load the recipe to show the plan
plan = None
plan_sexp = None # Native S-expression if available
recipe_ipfs_cid = None
recipe_id = run.get("recipe")
if recipe_id and len(recipe_id) == 64: # Looks like a hash
try:
@@ -189,6 +190,8 @@ async def get_run(
# Use native S-expression if available (code is data!)
if recipe.get("sexp"):
plan_sexp = recipe["sexp"]
# Get IPFS CID for the recipe
recipe_ipfs_cid = recipe.get("ipfs_cid")
# Build steps for DAG visualization
dag = recipe.get("dag", {})
@@ -329,6 +332,7 @@ async def get_run(
dag_elements=dag_elements,
output_media_type=output_media_type,
plan_sexp=plan_sexp,
recipe_ipfs_cid=recipe_ipfs_cid,
active_tab="runs",
)

View File

@@ -159,8 +159,16 @@
<!-- Recipe/Plan S-expression -->
{% if plan_sexp %}
<details class="mt-6" open>
<summary class="cursor-pointer text-gray-400 hover:text-white text-sm mb-2">
Recipe (S-expression)
<summary class="cursor-pointer text-gray-400 hover:text-white text-sm mb-2 flex items-center justify-between">
<span>Recipe (S-expression)</span>
{% if recipe_ipfs_cid %}
<a href="https://ipfs.io/ipfs/{{ recipe_ipfs_cid }}"
target="_blank"
onclick="event.stopPropagation()"
class="text-blue-400 hover:text-blue-300 text-xs font-mono ml-4">
ipfs://{{ recipe_ipfs_cid[:16] }}...
</a>
{% endif %}
</summary>
<div class="bg-gray-900 rounded-lg border border-gray-700 p-4 overflow-x-auto">
<pre class="text-sm font-mono sexp-code">{{ plan_sexp }}</pre>