The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
Merge remote-tracking branch 'origin/main' into feat/relay-slack-blockkit-native-parity
Victor Kyriazakosdd866eef3478
diff --cc gateway/relay/adapter.pyindex 71eb326bc72,281602922fa..d88815d676a--- a/gateway/relay/adapter.py+++ b/gateway/relay/adapter.py@@@ -137,23 -123,42 +137,63 @@@ class RelayAdapter(BasePlatformAdapter)def message_len_fn(self) -> Callable[[str], int]:return _LEN_FNS.get(self.descriptor.len_unit, len)+ @property+ def supports_status_text(self) -> bool: # type: ignore[override]+ """Whether the fronted platform renders a TEXT status line.++ Native parity (rich status text): Slack's typing surface is the+ assistant status line ("Finding answers…" next to the bot name), a+ text-rendering indicator. When the relay fronts Slack, advertise it so+ run.py's live-status lane feeds per-tool phrases via+ ``set_status_text()`` — exactly the wiring the native SlackAdapter+ gets (``supports_status_text = True``). Other fronted platforms keep+ textless typing bubbles and must NOT receive phrase traffic.++ Property (not class attr) because ONE RelayAdapter class fronts many- platforms; the answer depends on the handshaked descriptor.++ platforms; the answer depends on the handshaked descriptor. On a++ multi-platform relay this scalar reflects the PRIMARY identity's++ platform (same convention as the scalar ``descriptor``); per-chat++ egress paths that need chat-accurate capabilities use++ ``_descriptor_for_chat`` below.+ """+ return self.descriptor.platform == Platform.SLACK.value++ # ── per-chat capability resolution (Phase 1.5 multi-platform) ─────────+ def _descriptor_for_chat(self, chat_id: str) -> CapabilityDescriptor:+ """The capability descriptor governing a specific chat.++ A multi-platform gateway fronts N platforms on ONE adapter, but the+ scalar `descriptor`/`MAX_MESSAGE_LENGTH` surface can only carry one+ platform's profile (the primary identity's). Platform caps genuinely+ differ — Discord 2000 / Telegram 4096 / Slack 39000 — so applying the+ primary's cap to every chat either fragments needlessly (small primary)+ or over-sends into a platform 400 (large primary; the live bug: 2,543+ and 2,641-char sends rejected by Discord). Resolve the chat's platform+ from what we saw inbound (`_platform_by_chat`, the same map per-frame+ egress uses) and look up that platform's negotiated descriptor on the+ transport. Falls back to the scalar descriptor when the chat's platform+ is unknown (never saw inbound) or the transport predates the map.+ """+ platform = self._platform_by_chat.get(str(chat_id))+ if platform and self._transport is not None:+ resolve = getattr(self._transport, "descriptor_for_platform", None)+ if callable(resolve):+ try:+ per_platform = cast(+ Optional[CapabilityDescriptor], resolve(platform)+ )+ except Exception: # noqa: BLE001 - capability lookup must never break a send+ per_platform = None+ if per_platform is not None:+ return per_platform+ return self.descriptor++ def max_message_length_for_chat(self, chat_id: str) -> int:+ return self._descriptor_for_chat(chat_id).max_message_length++ def message_len_fn_for_chat(self, chat_id: str) -> Callable[[str], int]:+ return _LEN_FNS.get(self._descriptor_for_chat(chat_id).len_unit, len)+def supports_draft_streaming(self,chat_type: Optional[str] = None,