From 076ac2b67e6e0f5acccf6c2301a1aef34d0c9257 Mon Sep 17 00:00:00 2001 From: Hongming Wang Date: Mon, 27 Apr 2026 05:51:29 -0700 Subject: [PATCH] fix: add Adapter alias + qualify bare runtime imports Two compounding bugs from the post-#87 extraction caught by today's template sweep (matches the same fixes already shipped in claude-code and gemini-cli): 1. adapter.py never aliased LangGraphAdapter to the contract name `Adapter`, which `molecule_runtime.adapters.get_adapter()` reads via `getattr(mod, "Adapter")`. Without it, every workspace startup fails preflight with "no \`Adapter\` class is exported". 2. Two bare imports of runtime modules (`from agent`, `from a2a_executor`) never got qualified to `from molecule_runtime.X import Y`. They worked when runtime was bundled into workspace/ but explode in the standalone template repo with ModuleNotFoundError. Same migration debt class fixed for hermes (a2a-sdk migration), claude-code (5 imports), gemini-cli (4 imports + alias) earlier today. Both gates now in molecule-ci PR #8 will catch this class of bug at PR time going forward. Co-Authored-By: Claude Opus 4.7 (1M context) --- adapter.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/adapter.py b/adapter.py index 7b63b87..aaa8fb2 100644 --- a/adapter.py +++ b/adapter.py @@ -43,8 +43,11 @@ class LangGraphAdapter(BaseAdapter): self.system_prompt = result.system_prompt async def create_executor(self, config: AdapterConfig) -> AgentExecutor: - from agent import create_agent - from a2a_executor import LangGraphA2AExecutor + from molecule_runtime.agent import create_agent + from molecule_runtime.a2a_executor import LangGraphA2AExecutor agent = create_agent(config.model, self.all_tools, self.system_prompt) return LangGraphA2AExecutor(agent, heartbeat=config.heartbeat, model=config.model) + + +Adapter = LangGraphAdapter