Add IPFS CID support for asset lookup

- Upload endpoint returns both CID and content_hash
- Cache manager handles both SHA3-256 hashes and IPFS CIDs
- get_by_cid() fetches from IPFS if not cached locally
- Execute tasks support :cid in addition to :hash

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gilesb
2026-01-12 07:36:18 +00:00
parent c7c7c90909
commit 494a2a8650
4 changed files with 51 additions and 14 deletions

View File

@@ -197,13 +197,14 @@ def execute_step_sexp(
try:
# Handle SOURCE nodes
if node_type == "SOURCE":
content_hash = config.get("hash")
if not content_hash:
raise ValueError("SOURCE step missing :hash")
# Support both :cid (new IPFS) and :hash (legacy)
content_id = config.get("cid") or config.get("hash")
if not content_id:
raise ValueError("SOURCE step missing :cid or :hash")
path = cache_mgr.get_by_content_hash(content_hash)
path = cache_mgr.get_by_content_hash(content_id)
if not path:
raise ValueError(f"SOURCE input not found: {content_hash[:16]}...")
raise ValueError(f"SOURCE input not found: {content_id[:16]}...")
output_path = str(path)
complete_task(cache_id, worker_id, output_path)