"""Sample Adapters for Blender and Figma to emit provenance blocks (MVP)""" from __future__ import annotations import time from typing import Dict from .core import LocalProvenanceBlock def _default_metadata(extra: Dict = None) -> Dict: data = { "session": "default", "notes": "Generated by MVP adapter", "nonce": int(time.time()), } if extra: data.update(extra) return data class BlenderAdapter: def __init__(self, author: str = "BlenderAdapter") -> None: self.author = author self.tool = "Blender" def emit_block(self, block_id: str, action: str = "design") -> LocalProvenanceBlock: block = LocalProvenanceBlock( author=self.author, tool=self.tool, action=action, data={}, license="Standard-Commercial", timestamp=time.time(), id=block_id, ) return block # Convenience API used by tests def emit(self) -> LocalProvenanceBlock: return self.emit_block(block_id=f"blk-{int(time.time())}", action="design") class FigmaAdapter: def __init__(self, author: str = "FigmaAdapter") -> None: self.author = author self.tool = "Figma" def emit_block(self, block_id: str, action: str = "design") -> LocalProvenanceBlock: block = LocalProvenanceBlock( author=self.author, tool=self.tool, action=action, data={}, license="Standard-Commercial", timestamp=time.time(), id=block_id, ) return block # Convenience API used by tests def emit(self) -> LocalProvenanceBlock: return self.emit_block(block_id=f"blk-{int(time.time())}", action="design")