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."""
|
||||
|
||||
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 dataclasses import dataclass, field
|
||||
from typing import Any, Dict
|
||||
from typing import Any, Dict, List, Optional, Callable
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import Dict, List
|
||||
|
||||
from .adapter import Adapter
|
||||
from typing import List, Dict, Any
|
||||
|
||||
|
||||
class AdapterMarketplace:
|
||||
"""Minimal in-process marketplace for adapters.
|
||||
class Marketplace:
|
||||
"""A minimal adapter/contract marketplace scaffold.
|
||||
|
||||
This lightweight scaffold allows registering adapters and querying them
|
||||
by id. It is intentionally tiny to serve as a stepping stone toward a
|
||||
fuller registry/marketplace without affecting the core MVP surface.
|
||||
This MVP-friendly, in-memory marketplace collects simple items with an id
|
||||
and metadata. It is intentionally lightweight and meant to be extended
|
||||
later with better validation, versioning, and persistence.
|
||||
"""
|
||||
|
||||
def __init__(self) -> None:
|
||||
self._adapters: Dict[str, Adapter] = {}
|
||||
self._items: List[Dict[str, Any]] = []
|
||||
|
||||
def register_adapter(self, adapter: Adapter) -> None:
|
||||
if not isinstance(adapter, Adapter): # type: ignore[unreachable]
|
||||
raise TypeError("adapter must be an instance of Adapter")
|
||||
self._adapters[adapter.adapter_id] = adapter
|
||||
def add_item(self, item: Dict[str, Any]) -> None:
|
||||
if not isinstance(item, dict) or "id" not in item:
|
||||
raise ValueError("marketplace item must be a dict containing an 'id' field")
|
||||
self._items.append(item)
|
||||
|
||||
def list_adapters(self) -> List[str]:
|
||||
return list(self._adapters.keys())
|
||||
def list_items(self) -> List[Dict[str, Any]]:
|
||||
# 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