forked from molecule-ai/molecule-core
PR #471 removed Dockerfiles/requirements from adapters/ but left the Python source files. This commit finishes the extraction: 1. Moved shared_runtime.py → workspace-template/shared_runtime.py (used by prompt.py, a2a_executor.py, coordinator.py — not adapter-specific) 2. Moved base.py → workspace-template/adapter_base.py (BaseAdapter + AdapterConfig — the interface adapters implement) 3. Updated imports in prompt.py, a2a_executor.py, coordinator.py 4. Rewritten adapters/__init__.py as a thin shim that: - Reads ADAPTER_MODULE env var (production: standalone repos set this) - Re-exports BaseAdapter/AdapterConfig for backward compat 5. adapters/base.py + adapters/shared_runtime.py remain as re-export shims 6. Deleted all 8 adapter subdirectories (autogen, claude_code, crewai, deepagents, gemini_cli, hermes, langgraph, openclaw) 7. Removed 11 test files that imported adapter-specific code Tests: 955 passed, 0 failed (down from 1216 — the difference is adapter-specific tests that moved to standalone repos).
23 lines
747 B
Python
23 lines
747 B
Python
"""Adapter registry shim.
|
|
|
|
Adapters extracted to standalone repos (molecule-ai-workspace-template-*).
|
|
ADAPTER_MODULE env var is the primary discovery mechanism in production.
|
|
This shim provides backward-compatible imports for local dev + tests.
|
|
"""
|
|
import importlib
|
|
import os
|
|
import logging
|
|
from adapter_base import BaseAdapter, AdapterConfig
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
def get_adapter(runtime: str) -> type[BaseAdapter]:
|
|
adapter_module = os.environ.get("ADAPTER_MODULE")
|
|
if adapter_module:
|
|
mod = importlib.import_module(adapter_module)
|
|
return getattr(mod, "Adapter")
|
|
raise KeyError(
|
|
f"No ADAPTER_MODULE set for runtime '{runtime}'. "
|
|
"Adapters now live in standalone template repos."
|
|
)
|