Skip to content

feat(gateway): multi-platform delivery simulator - #80175

Open
JoaoMarcos44 wants to merge 1 commit into
NousResearch:mainfrom
JoaoMarcos44:feat/gateway-simulate-delivery
Open

JoaoMarcos44 wants to merge 1 commit into
NousResearch:mainfrom
JoaoMarcos44:feat/gateway-simulate-delivery

Conversation

@JoaoMarcos44

@JoaoMarcos44 JoaoMarcos44 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds hermes gateway simulate-delivery --platform <p> --text/--input [--json] — a preview command that renders and chunks content through the REAL adapter code for Telegram, Discord, Slack, and WhatsApp, with zero network calls and no credentials required.

%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#8b0000', 'mainBkg': '#0a0204', 'primaryTextColor': '#ffccd5', 'primaryBorderColor': '#ff0038', 'lineColor': '#ff0038'}}}%%
graph TD
    A[Raw Input Text] -->|Real format_message| B[Adapter Renderer]
    B -->|Telegram| C[MarkdownV2 Escaping]
    B -->|Discord| D[GFM Table to Bullets]
    B -->|Slack| E[mrkdwn]
    B -->|WhatsApp| F[Native Formatting]
    C --> G[truncate_message Chunker]
    D --> G
    E --> G
    F --> G
    G -->|No Network, No Credentials| H[Formatted Output + Chunk Report]
Loading

Infographic :

gateway_simulator_infographic

Closes #80174

Why this doesn't duplicate existing work

Design notes

  • Oracles imported, never reimplemented. format_message() is called unbound (AdapterClass.format_message(None, text)) for Telegram/Discord/Slack, and via a bare object.__new__(WhatsAppBehaviorMixin) instance for WhatsApp — the exact construction scripts/generate_conformance_vectors.py uses, asserted self-free by tests/conformance/test_vector_generator.py.
  • Chunking is the real BasePlatformAdapter.truncate_message() static method (code-fence-boundary preservation included), called with each adapter's real MAX_MESSAGE_LENGTH and len_fn (Telegram measures UTF-16 code units via utf16_len, matching gateway/delivery.py's real call site).
  • Scoped down from the original proposal. The original report also asked for draft-vs-final streaming diffs and logical wire payloads. Those are genuinely adapter-specific (Telegram edit-streaming, Discord multi-message threading) and reimplementing them "byte-for-byte" within a correctness-first MVP risks shipping a tool that lies to the user — worse than not having it. This PR ships the rendering+chunking slice only, which is also the exact bug class bug(telegram): rich_messages + draft streaming renders crooked MDV2 preview then a second wiki/rich final #78524 reports. Draft/streaming simulation is a natural follow-up once this lands.
  • New CLI wiring: simulate-delivery subparser added to the existing gateway parser (hermes_cli/subcommands/gateway.py), dispatched via one guard clause added at the top of hermes_cli/gateway.py::_gateway_command_inner — no existing gateway subcommand branch was touched.

Test plan

  • pytest tests/hermes_cli/test_gateway_delivery_simulator.py -q — 11 passing: real MarkdownV2 escaping, Discord pass-through, UTF-16 length check, chunk-boundary correctness (len(chunk) <= max_length for every chunk), unsupported-platform error, file-input path, JSON output
  • pytest tests/hermes_cli/test_gateway.py -q — no regressions (10 passed, 5 pre-existing skips)
  • ruff check on new/changed files — clean
  • Manual run: hermes gateway simulate-delivery --platform telegram --text "Price 3.50 (was 4.00) save ~12%!" → correctly escaped MarkdownV2 output; --platform whatsapp --json; unsupported platform → clean error message

Adds `hermes gateway simulate-delivery --platform <p> --text/--input [--json]`,
previewing real per-adapter format_message() rendering and
truncate_message() chunking (Telegram/Discord/Slack/WhatsApp) with zero
network calls and no credentials — catches rendering/chunking bugs before
a live send instead of after.

Resolves NousResearch#80174
@alt-glitch alt-glitch added type/feature New feature or request comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery platform/telegram Telegram bot adapter platform/discord Discord bot adapter platform/slack Slack app adapter platform/whatsapp WhatsApp Business adapter P3 Low — cosmetic, nice to have labels Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have platform/discord Discord bot adapter platform/slack Slack app adapter platform/telegram Telegram bot adapter platform/whatsapp WhatsApp Business adapter type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: multi-platform delivery simulator (hermes gateway simulate-delivery)

2 participants