The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(gateway): slash_commands resolves adapters through the intake/delivery seams
teknium1b5284aaa49fc
diff --git a/gateway/slash_commands.py b/gateway/slash_commands.pyindex 1b0dd0309e1..663302803c0 100644--- a/gateway/slash_commands.py+++ b/gateway/slash_commands.py@@ -215,7 +215,7 @@ class GatewaySlashCommandsMixin(OWN transport (profile-aware, fail-closed) — ``self.adapters`` is the default profile's map."""if not event.source:return None, None- return self._adapter_for_source(event.source), self._session_key_for_source(event.source)+ return self._delivery_adapter_for(event.source), self._session_key_for_source(event.source)def _telegramized_command_reply(self, event: MessageEvent, text: str) -> str:from gateway.run import _telegramize_command_mentions@@ -259,7 +259,7 @@ class GatewaySlashCommandsMixin((WeCom msgtype:"stream"), which need it sent directly with control-lane metadata (reliableproactive send, not the finalized reply stream). ``is not True``: mocks auto-create attrs."""source = event.source- adapter = self._adapter_for_source(source) # the receiving bot, not the default profile's+ adapter = self._delivery_adapter_for(source) # the receiving bot, not the default profile'sif adapter:adapter.resume_typing_for_chat(source.chat_id) # agent is about to continueif getattr(adapter, "SUPPORTS_NATIVE_STREAMING", False) is not True:@@ -606,7 +606,7 @@ class GatewaySlashCommandsMixin(return t("gateway.set_home.save_failed", error="Missing logical platform")via_relay = getattr(source, "delivered_via_upstream_relay", False) is Trueif via_relay:- adapter_for_source = getattr(self, "_adapter_for_source", None)+ adapter_for_source = getattr(self, "_intake_adapter_for", None)relay_adapter = adapter_for_source(source) if callable(adapter_for_source) else Nonefronts_platform = getattr(relay_adapter, "fronts_platform", None)if (source.platform in {None, Platform.LOCAL, Platform.RELAY}@@ -647,7 +647,7 @@ class GatewaySlashCommandsMixin(# independent /voice state.# See #75198.voice_key = self._voice_key_for_source(event.source)- adapter = self._adapter_for_source(event.source)+ adapter = self._delivery_adapter_for(event.source)def _set_mode(mode: str) -> None:self._voice_mode[voice_key] = mode@@ -845,7 +845,7 @@ class GatewaySlashCommandsMixin(except Exception:parent_agent = None_thread_metadata = self._reply_metadata(event)- adapter = self._adapter_for_source(source)+ adapter = self._delivery_adapter_for(source)preview = _preview(question)async def _run_side_question() -> None:@@ -988,7 +988,7 @@ class GatewaySlashCommandsMixin(# adapter refresh below doesn't keep a stale value and keep interrupting.self._busy_text_mode = self._load_busy_text_mode()- adapter = self._adapter_for_source(event.source)+ adapter = self._delivery_adapter_for(event.source)if adapter is not None:adapter._busy_text_mode = self._effective_busy_text_mode(event.source)return EphemeralReply(