refactor: T4 fast-cheap; move adapter registries from code to team.yaml
This commit is contained in:
@@ -8,6 +8,17 @@ adapters:
|
||||
vcs: github
|
||||
notify: openclaw
|
||||
|
||||
adapter_registry:
|
||||
llm:
|
||||
anthropic: "adapters.llm.anthropic:AnthropicAdapter"
|
||||
vcs:
|
||||
github: "adapters.vcs.github:GitHubAdapter"
|
||||
notify:
|
||||
openclaw: "adapters.notify.openclaw:OpenClawNotifyAdapter"
|
||||
runtime:
|
||||
openclaw: "adapters.runtime.openclaw:OpenClawRuntimeAdapter"
|
||||
claude_code: "adapters.runtime.claude_code:ClaudeCodeRuntimeAdapter"
|
||||
|
||||
models:
|
||||
default_max_tokens: 4096
|
||||
default_temperature: 0
|
||||
|
||||
@@ -166,6 +166,12 @@ class TeamRunner:
|
||||
|
||||
self._config = self._load_yaml(config_path)
|
||||
self._role_registry = self._load_yaml("config/role_registry.yaml")
|
||||
# Merge config-defined adapter_registry over built-in fallbacks.
|
||||
self._adapter_registry: dict[str, dict[str, str]] = {
|
||||
k: {**v} for k, v in _BUILTIN_ADAPTER_REGISTRY.items()
|
||||
}
|
||||
for kind, entries in self._config.get("adapter_registry", {}).items():
|
||||
self._adapter_registry.setdefault(kind, {}).update(entries)
|
||||
self._escalation = EscalationHandler()
|
||||
|
||||
run_id = str(uuid.uuid4())
|
||||
@@ -188,10 +194,10 @@ class TeamRunner:
|
||||
else:
|
||||
self._llm = self._build_llm(adapter_cfg.get("llm", "anthropic"))
|
||||
self._vcs: Optional[VCSAdapter] = self._build_optional( # type: ignore[assignment]
|
||||
_VCS_ADAPTERS, adapter_cfg.get("vcs"), "VCS"
|
||||
self._adapter_registry.get("vcs", {}), adapter_cfg.get("vcs"), "VCS"
|
||||
)
|
||||
self._notify: Optional[NotifyAdapter] = self._build_optional( # type: ignore[assignment]
|
||||
_NOTIFY_ADAPTERS, adapter_cfg.get("notify"), "notify"
|
||||
self._adapter_registry.get("notify", {}), adapter_cfg.get("notify"), "notify"
|
||||
)
|
||||
# Runtime adapters are fully config-driven — one entry per string-valued
|
||||
# key in the top-level ``runtime:`` section of team.yaml.
|
||||
@@ -216,7 +222,7 @@ class TeamRunner:
|
||||
return fh.read()
|
||||
|
||||
def _build_llm(self, key: str) -> LLMAdapter:
|
||||
cls = _load_adapter_class(key, _LLM_ADAPTERS, "LLM")
|
||||
cls = _load_adapter_class(key, self._adapter_registry.get("llm", {}), "LLM")
|
||||
return cls(self._config)
|
||||
|
||||
def _build_optional(
|
||||
@@ -244,7 +250,7 @@ class TeamRunner:
|
||||
return None
|
||||
|
||||
def _build_runtime(self, key: str) -> RuntimeAdapter:
|
||||
cls = _load_adapter_class(key, _RUNTIME_ADAPTERS, "runtime")
|
||||
cls = _load_adapter_class(key, self._adapter_registry.get("runtime", {}), "runtime")
|
||||
return cls(self._config)
|
||||
|
||||
def _build_runtimes(self, runtime_cfg: dict) -> dict[str, RuntimeAdapter]:
|
||||
|
||||
Reference in New Issue
Block a user