[GH-ISSUE #5058] [Other] Chat bridges: talk to the local model from Telegram, Discord and WhatsApp #2347

Open
opened 2026-11-04 01:58:37 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @storm-ace on GitHub (Nov 3, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/5058

Area

[Other] (anything else, including setup and installation). It touches both the Terminal ([TUI]) and the app ([GUI]), so I picked Other.

What do you want to do?

Talk to the model on my own PC from the chat apps I already use: Telegram, Discord and, later, WhatsApp. For example, ask a question from my phone while the PC at home is serving. Today the model is only reachable from the app, the web page or tools that speak the API.

This is a proposal to agree the scope before anyone writes code, as CONTRIBUTING asks for a large feature. Nothing here is built or measured yet.

Idea: one opt-in bridge process next to the server

Telegram ─┐  long polling (outgoing only)
Discord  ─┼─► strata-bridge ──► http://127.0.0.1:8095/v1/chat/completions (with the API key)
WhatsApp ─┘  webhook through the existing Cloudflare tunnel (only this one needs a public address)
  • No change to the engine or the server. With no bridge turned on, everything stays byte-identical.
  • Telegram and Discord only make outgoing connections, so the server stays on 127.0.0.1 and no port opens.
  • One implementation in Python (for example strata_bridges/). The Terminal calls it directly. The app's host starts and watches it the way it already runs strata_control.
  • Each platform is a small adapter (run, send, edit, typing, plus limits such as Discord's 2000 and Telegram's 4096 characters). The shared core handles chat history per conversation, a queue when the server is busy, cutting long answers into pieces, streaming by editing a message, removing <think>, and the chat commands /reset, /stop and /help.
  • WhatsApp only through the official Cloud API. Unofficial libraries break WhatsApp's terms and can get the user's number banned.

Safety (the default is the safe one)

  • Secrets are saved as references only, like strata_cli/connections.py already does (token_env: "STRATA_TELEGRAM_TOKEN"). The app keeps the token in the OS keychain.
  • Pairing: an unknown person gets a 6-digit code and nothing else. The owner allows them with strata bridge pair telegram <code> or with an Allow button in the app. Messages from people not on the list never reach the GPU.
  • Chat only by default. Agent mode with tools is opt-in per bridge, and Manual-mode approvals arrive as buttons in the chat.
  • Discord answers only in direct messages, or when @mentioned in channels you allow.
  • A rate limit per person and a cap on the history kept per chat.

Terminal

strata bridge list | add <app> | pair <app> <code> | deny <app> <id>
strata bridge start | stop | check | status | logs | set <app> key=value
strata launch ... --bridge telegram

check works like strata connect --check: token, server and one prompt, exit code 0 or 1. Every command takes --output json. strata launch --status gets a "Bridges" line, and --stop stops the bridges too.

App

A new Settings › Chat apps panel:

  • One card per app, with an on/off switch and its status.
  • A four-step wizard: choose the app, make the bot, paste and check the token, allow yourself.
  • A page per app to manage it: who may chat, the mode, the model, instructions for the bot, thinking shown or not, and Unlink.
  • Pairing requests appear as an Allow / Ignore banner.

The app and the Terminal read the same settings file.

Mockups (drawn in the app's own dark tokens from apps/host/src/styles/kit/tokens.css; nothing here is built)

App: Settings › Chat apps Settings dialog with a new Chat apps panel: a pairing request banner, one row per app with status and an on/off switch, and a safety list
App: the wizard (step 3 of 4, token checked) Add a chat app wizard at step 3: bot token field, chat only or agent mode, and three passed checks
App: managing one bridge Telegram management page: people who may chat, mode, model, instructions, show thinking, show chats in Strata, the same commands for the Terminal, and Unlink
Terminal: add, start and pair strata bridge add telegram, start and pair in PowerShell
Terminal: list, check and launch strata bridge list, check discord with one failed check, launch with --bridge and launch --status

Suggested order, one PR each:

  1. Bridge core + Telegram + strata bridge + tests with a fake adapter (no network).
  2. The app panel.
  3. Discord.
  4. WhatsApp Cloud API.

Questions for the maintainers

  • Is this welcome in Strata itself, or should it stay with outside tools? (See the workaround below.)
  • Is a new top-level package (strata_bridges/) fine, or should it go under strata_control/?
  • Discord needs a websocket library. Is an optional component (like the engine components) fine, or should it stay standard-library only?

What do you do today instead?

Run a separate assistant that already supports chat channels, such as OpenClaw or Hermes Agent, and point it at Strata with strata connect openclaw. That works, but it is a second large program to install and set up (OpenClaw needs Node 24.16+). Pairing and keeping the server on 127.0.0.1 then depend on that tool, and the app shows nothing about it.

Originally created by @storm-ace on GitHub (Nov 3, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/5058 ### Area [Other] (anything else, including setup and installation). It touches both the Terminal ([TUI]) and the app ([GUI]), so I picked Other. ### What do you want to do? Talk to the model on my own PC from the chat apps I already use: Telegram, Discord and, later, WhatsApp. For example, ask a question from my phone while the PC at home is serving. Today the model is only reachable from the app, the web page or tools that speak the API. This is a proposal to agree the scope before anyone writes code, as CONTRIBUTING asks for a large feature. Nothing here is built or measured yet. **Idea: one opt-in bridge process next to the server** ``` Telegram ─┐ long polling (outgoing only) Discord ─┼─► strata-bridge ──► http://127.0.0.1:8095/v1/chat/completions (with the API key) WhatsApp ─┘ webhook through the existing Cloudflare tunnel (only this one needs a public address) ``` - No change to the engine or the server. With no bridge turned on, everything stays byte-identical. - Telegram and Discord only make outgoing connections, so the server stays on `127.0.0.1` and no port opens. - One implementation in Python (for example `strata_bridges/`). The Terminal calls it directly. The app's host starts and watches it the way it already runs `strata_control`. - Each platform is a small adapter (`run`, `send`, `edit`, `typing`, plus limits such as Discord's 2000 and Telegram's 4096 characters). The shared core handles chat history per conversation, a queue when the server is busy, cutting long answers into pieces, streaming by editing a message, removing `<think>`, and the chat commands `/reset`, `/stop` and `/help`. - WhatsApp only through the official Cloud API. Unofficial libraries break WhatsApp's terms and can get the user's number banned. **Safety (the default is the safe one)** - Secrets are saved as references only, like `strata_cli/connections.py` already does (`token_env: "STRATA_TELEGRAM_TOKEN"`). The app keeps the token in the OS keychain. - Pairing: an unknown person gets a 6-digit code and nothing else. The owner allows them with `strata bridge pair telegram <code>` or with an Allow button in the app. Messages from people not on the list never reach the GPU. - Chat only by default. Agent mode with tools is opt-in per bridge, and Manual-mode approvals arrive as buttons in the chat. - Discord answers only in direct messages, or when @mentioned in channels you allow. - A rate limit per person and a cap on the history kept per chat. **Terminal** ``` strata bridge list | add <app> | pair <app> <code> | deny <app> <id> strata bridge start | stop | check | status | logs | set <app> key=value strata launch ... --bridge telegram ``` `check` works like `strata connect --check`: token, server and one prompt, exit code 0 or 1. Every command takes `--output json`. `strata launch --status` gets a "Bridges" line, and `--stop` stops the bridges too. **App** A new **Settings › Chat apps** panel: - One card per app, with an on/off switch and its status. - A four-step wizard: choose the app, make the bot, paste and check the token, allow yourself. - A page per app to manage it: who may chat, the mode, the model, instructions for the bot, thinking shown or not, and Unlink. - Pairing requests appear as an Allow / Ignore banner. The app and the Terminal read the same settings file. **Mockups** (drawn in the app's own dark tokens from `apps/host/src/styles/kit/tokens.css`; nothing here is built) <details open> <summary>App: Settings › Chat apps</summary> <img width="1280" height="900" alt="Settings dialog with a new Chat apps panel: a pairing request banner, one row per app with status and an on/off switch, and a safety list" src="https://github.com/user-attachments/assets/4d14e3de-d34c-488f-9ea2-a594277e63dd" /> </details> <details> <summary>App: the wizard (step 3 of 4, token checked)</summary> <img width="1280" height="900" alt="Add a chat app wizard at step 3: bot token field, chat only or agent mode, and three passed checks" src="https://github.com/user-attachments/assets/6aab454f-982a-433b-a160-d639be1e7b19" /> </details> <details> <summary>App: managing one bridge</summary> <img width="1280" height="1240" alt="Telegram management page: people who may chat, mode, model, instructions, show thinking, show chats in Strata, the same commands for the Terminal, and Unlink" src="https://github.com/user-attachments/assets/6338d86a-4cd8-4584-9c33-a3fe7db8d002" /> </details> <details> <summary>Terminal: add, start and pair</summary> <img width="960" height="980" alt="strata bridge add telegram, start and pair in PowerShell" src="https://github.com/user-attachments/assets/12ea39d5-f59a-4629-aa81-5a488656e2ee" /> </details> <details> <summary>Terminal: list, check and launch</summary> <img width="960" height="980" alt="strata bridge list, check discord with one failed check, launch with --bridge and launch --status" src="https://github.com/user-attachments/assets/bedfe385-8791-4639-9fea-e5ddc2f465dd" /> </details> **Suggested order, one PR each:** 1. Bridge core + Telegram + `strata bridge` + tests with a fake adapter (no network). 2. The app panel. 3. Discord. 4. WhatsApp Cloud API. **Questions for the maintainers** - Is this welcome in Strata itself, or should it stay with outside tools? (See the workaround below.) - Is a new top-level package (`strata_bridges/`) fine, or should it go under `strata_control/`? - Discord needs a websocket library. Is an optional component (like the engine components) fine, or should it stay standard-library only? ### What do you do today instead? Run a separate assistant that already supports chat channels, such as OpenClaw or Hermes Agent, and point it at Strata with `strata connect openclaw`. That works, but it is a second large program to install and set up (OpenClaw needs Node 24.16+). Pairing and keeping the server on `127.0.0.1` then depend on that tool, and the app shows nothing about it.
Author
Owner

@storm-ace commented on GitHub (Nov 3, 2026):

Claude design: https://claude.ai/artifact/DYqKvNgquLtoFzzkJxuo54#page-dcb81aee8d83

<!-- gh-comment-id:6597839660 --> @storm-ace commented on GitHub (Nov 3, 2026): Claude design: https://claude.ai/artifact/DYqKvNgquLtoFzzkJxuo54#page-dcb81aee8d83
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#2347
No description provided.