build(agent): molt-z#db0ec5 iteration
This commit is contained in:
parent
c123ad41e0
commit
2af858015f
|
|
@ -1,5 +1,6 @@
|
||||||
"""GridVerse Open Low-Code Platform for CRO - lightweight MVP package."""
|
"""GridVerse Open Low-Code Platform for CRO - lightweight MVP package."""
|
||||||
|
|
||||||
from .core import Object, Morphism, Functor # re-export core types
|
from .core import Object, Morphism, Functor # re-export core types
|
||||||
|
from .marketplace import Marketplace # lightweight marketplace scaffold
|
||||||
|
|
||||||
__all__ = ["Object", "Morphism", "Functor"]
|
__all__ = ["Object", "Morphism", "Functor", "Marketplace"]
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import Any, Dict
|
|
||||||
from typing import Any, Dict, List, Optional, Callable
|
from typing import Any, Dict, List, Optional, Callable
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,27 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Dict, List
|
from typing import List, Dict, Any
|
||||||
|
|
||||||
from .adapter import Adapter
|
|
||||||
|
|
||||||
|
|
||||||
class AdapterMarketplace:
|
class Marketplace:
|
||||||
"""Minimal in-process marketplace for adapters.
|
"""A minimal adapter/contract marketplace scaffold.
|
||||||
|
|
||||||
This lightweight scaffold allows registering adapters and querying them
|
This MVP-friendly, in-memory marketplace collects simple items with an id
|
||||||
by id. It is intentionally tiny to serve as a stepping stone toward a
|
and metadata. It is intentionally lightweight and meant to be extended
|
||||||
fuller registry/marketplace without affecting the core MVP surface.
|
later with better validation, versioning, and persistence.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
self._adapters: Dict[str, Adapter] = {}
|
self._items: List[Dict[str, Any]] = []
|
||||||
|
|
||||||
def register_adapter(self, adapter: Adapter) -> None:
|
def add_item(self, item: Dict[str, Any]) -> None:
|
||||||
if not isinstance(adapter, Adapter): # type: ignore[unreachable]
|
if not isinstance(item, dict) or "id" not in item:
|
||||||
raise TypeError("adapter must be an instance of Adapter")
|
raise ValueError("marketplace item must be a dict containing an 'id' field")
|
||||||
self._adapters[adapter.adapter_id] = adapter
|
self._items.append(item)
|
||||||
|
|
||||||
def list_adapters(self) -> List[str]:
|
def list_items(self) -> List[Dict[str, Any]]:
|
||||||
return list(self._adapters.keys())
|
# Return a shallow copy to prevent external mutation
|
||||||
|
return list(self._items)
|
||||||
|
|
||||||
def get_adapter(self, adapter_id: str) -> Adapter:
|
|
||||||
return self._adapters[adapter_id]
|
__all__ = ["Marketplace"]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue