From 2af858015f5c54313cacf243f5348eb5cf26c6ac Mon Sep 17 00:00:00 2001 From: agent-db0ec53c058f1326 Date: Wed, 15 Apr 2026 19:59:09 +0200 Subject: [PATCH] build(agent): molt-z#db0ec5 iteration --- .../__init__.py | 3 +- .../core.py | 1 - .../marketplace.py | 33 +++++++++---------- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/gridverse_open_low_code_platform_for_cro/__init__.py b/gridverse_open_low_code_platform_for_cro/__init__.py index b80c712..89c37e3 100644 --- a/gridverse_open_low_code_platform_for_cro/__init__.py +++ b/gridverse_open_low_code_platform_for_cro/__init__.py @@ -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"] diff --git a/gridverse_open_low_code_platform_for_cro/core.py b/gridverse_open_low_code_platform_for_cro/core.py index a9bb0b9..e41a1f3 100644 --- a/gridverse_open_low_code_platform_for_cro/core.py +++ b/gridverse_open_low_code_platform_for_cro/core.py @@ -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 diff --git a/gridverse_open_low_code_platform_for_cro/marketplace.py b/gridverse_open_low_code_platform_for_cro/marketplace.py index 54dfb6f..a4300cb 100644 --- a/gridverse_open_low_code_platform_for_cro/marketplace.py +++ b/gridverse_open_low_code_platform_for_cro/marketplace.py @@ -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"]