dsh-message-gateway 0.1.16 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.en.md CHANGED
@@ -2,41 +2,50 @@
2
2
 
3
3
  [中文](README.md) · [Español](README.es.md)
4
4
 
5
- A message-platform gateway plugin for the DSH Web GUI: a "Message platforms" entry below the "New session" button opens a full-screen manager for multi-platform message connectors — credential save, connection tests, status monitoring — plus a built-in persistent bridge for the WeCom AI bot: external messages drive the DSH assistant through a dedicated agent session, and replies stream back token by token.
5
+ ![dsh-message-gateway UI Preview](assets/screenshot.png)
6
+
7
+ A message-platform gateway plugin for the DSH Web GUI: a "Message platforms" entry below the "New session" button opens a full-screen manager for multi-platform message connectors — credential save, connection tests, status monitoring — plus a built-in persistent bridge for the WeCom AI bot: external messages drive the DSH assistant through a dedicated agent session, and replies stream back token by token. Also provides a universal proactive messaging API supporting Markdown text and native image attachments.
6
8
 
7
9
  ## Features
8
10
 
9
11
  - **Sidebar entry**: a "📮 Message platforms" button below "New session" opens the full-screen manager (close with ESC or by clicking the backdrop)
10
- - **Multi-platform connectors**: Telegram / Discord / QQ bot / WeCom / WeCom AI bot / WeChat (external Wechaty gateway) / WeChat Official Account / WhatsApp / Email / Webhooks
11
- - **Telegram bot**: save a Bot Token to enable long polling instantly; chat with the bot directly (streaming replies via send + progressive edit, same as web)
12
- - **Discord bot**: save a Bot Token to connect to the gateway (enable the MESSAGE CONTENT privileged intent in the developer portal); chat in channels or DMs
13
- - **QQ bot**: save appId + secret to connect to the open-platform gateway (channels/groups/DMs); passive replies + streaming edits
14
- - **WeCom app**: fill in CorpID/AgentID/Secret plus the callback Token/EncodingAESKey, configure the callback URL (`/gateway/wecom/callback`) in the admin console, and users who message the app get auto replies
15
- - **WeChat Official Account**: fill in AppID/Secret plus the callback Token, configure the server URL (`/gateway/wechat-mp/callback`) in the console, and followers who message get auto replies
16
- - **WhatsApp**: fill in Token + Phone Number ID, configure the webhook (`/gateway/whatsapp/webhook`) in the Meta console, and users who message get auto replies
17
- - **Email**: fill in IMAP (receiving, 993/143) + SMTP (replying, 465/587/25); messages are grouped into per-thread sessions and replies use Re: original subject
18
- - **DingTalk Bot**: configure custom bot Webhook & optional HMAC Secret for group notifications
19
- - **Feishu / Lark Bot**: configure custom bot Webhook & optional Secret signature for message delivery
20
- - **Bark (iOS)**: fill in Device Key for instant push notifications on Apple devices
21
- - **ServerChan**: fill in SendKey for push notifications to WeChat / mobile channels
12
+ - **Multi-platform connectors**: Telegram / Discord / QQ bot / WeCom / WeCom AI bot / WeChat (external Wechaty gateway) / WeChat Official Account / WhatsApp / Email / DingTalk / Feishu / Bark / ServerChan / Webhooks
13
+ - **WeCom AI bot**: fill in `botId + secret` to establish an official SDK WebSocket connection; supports streaming replies, media upload, and **proactive image/file push**
14
+ - **Telegram bot**: save a Bot Token to enable long polling, supporting text streaming and `sendPhoto` **proactive image push**
15
+ - **Discord bot**: save a Bot Token to connect via Gateway, supporting channels/DMs and `files` attachment **proactive image push**
16
+ - **DingTalk Bot**: configure custom bot Webhook & optional HMAC Secret; supports Markdown text and public image URL rendering
17
+ - **Feishu / Lark Bot**: configure custom bot Webhook & optional Secret signature for text and card delivery
18
+ - **Bark (iOS)**: fill in Device Key for instant push notifications with rich image banners (public URL)
19
+ - **ServerChan**: fill in SendKey for push notifications to WeChat / mobile channels with Markdown image URLs
20
+ - **QQ bot**: save appId + secret to connect to the open-platform gateway; passive replies + streaming edits
21
+ - **WeCom app**: fill in CorpID/AgentID/Secret plus callback Token/EncodingAESKey for auto-dialogues
22
+ - **WeChat Official Account**: fill in AppID/Secret plus callback Token for follower dialogues
23
+ - **WhatsApp**: fill in Token + Phone Number ID for WhatsApp webhook dialogues
24
+ - **Email**: fill in IMAP (993/143) + SMTP (465/587/25) for threaded email conversations
25
+ - **Universal proactive push channel**: `POST /gateway/push` (for cron jobs, automation scripts, and pipelines):
26
+ - Request body:
27
+ - `platform`: target platform (`wecom-aibot` / `telegram` / `discord` / `dingtalk` / `feishu` / `bark` / `serverchan` / `email`)
28
+ - `target`: destination target (single-chat userid or group id for `wecom-aibot`; numeric chatId for `telegram`; channelId for `discord`; deviceKey for `bark`, etc.)
29
+ - `content`: optional text content (supports Markdown)
30
+ - `title`: optional title (email subject or notification prefix)
31
+ - `image`: optional image data (**Base64** data or accessible `http(s)://` image URL)
32
+ - `filename`: optional image filename (defaults to `image.png`)
33
+ - Highlights:
34
+ - Text and image can be pushed together or separately
35
+ - `wecom-aibot`, `telegram`, and `discord` support uploading raw local binary buffers directly
36
+ - `bark`, `dingtalk`, and `serverchan` automatically adapt to public image URLs
22
37
  - **Credential management**: plaintext is persisted only to `~/.dsh/gateway.json` (mode 600, atomic write); `/gateway/list` never returns credential plaintext, only a `configured` flag
23
38
  - **Secret redaction**: message content written to logs / console is automatically masked for likely secrets (`sk-` prefixed keys, GitHub tokens, `Bearer`, `password=` assignments, PEM private keys, and other common patterns), so secrets in bot conversations never leak into log files
24
39
  - **Connection tests**: real per-platform checks — Telegram/Discord via Bot API, QQ via access_token, WeCom via gettoken, WeChat MP via cgi-bin/token, WhatsApp via Graph API, Email via IMAP TCP banner, WeCom AI bot via the official SDK long connection (authenticated = pass)
25
40
  - **WeCom AI bot persistent bridge**: official SDK WebSocket long connection with exponential backoff reconnect; incoming text messages are injected into an isolated dedicated agent session that wakes the DSH driver; replies stream back as chunks and finalize via `response_url`
26
41
  - **Group-chat @mention stripping**: the leading `@bot-name` is removed before the assistant sees the message
27
- - **Slash commands**: `/help` / `/time` / `/status` (Chinese aliases: 帮助/菜单/时间/状态)
42
+ - **Slash commands**: `/help` / `/time` / `/status` / `/stats` (Chinese aliases: 帮助/菜单/时间/状态/统计)
28
43
  - **Enter-chat welcome**: optional configuration (`welcomeReply`, defaults to `false` for zero disturbance; when set to `true`, auto-replies a greeting when a user enters single chat for the first time that day)
29
- - **Proactive send channel**: `POST /gateway/send` (`{"chatid": "...", "content": "..."}`, single chat = userid, group chat = group id) sends markdown messages as the bot
30
- - **Universal proactive push**: `POST /gateway/push` (`{"platform": "...", "target": "...", "content": "...", "title": "optional"}`) pushes text to any platform target for task notifications / other plugins:
31
- - `platform` supports `telegram` (target = numeric chatId), `discord` (target = channelId), `wecom-aibot` (target = userid/group id), `email` (target = address, title becomes the subject)
32
- - QQ has no active push since 2025-04-21 (passive replies only); calling it returns a clear error
33
- - an unconnected platform returns `bridge not connected`
34
- - **Message routing rules** (plugin config `routes`): route messages by "platform + keyword prefix" to a specific **agent preset** (isolated session) with an optional **dedicated model / skill**. E.g. `{ id: "code", matchPlatform: "telegram", matchPrefix: "code ", agentPreset: "code" }` makes `code write a function` on Telegram enter a code-preset session. First matching rule wins; unmatched messages use the default agent
35
- - **Slash commands**: `/help` / `/time` / `/status` / `/stats` (Chinese aliases: 帮助/菜单/时间/状态/统计); `/stats` shows per-bridge connection status and active chat count
36
- - **Agent push tool** (`send_chat_message`): automatically registers a universal message-pushing tool for DSH agents, allowing AI assistants to proactively send summaries, task results, or alerts to Telegram, Discord, WeCom, or Email directly within conversations
37
- - **Webhook receive endpoint**: `POST /gateway/webhook/in` accepts messages from external systems (any of `text` / `content` / `message`), injects them into the dedicated agent session and returns the full reply synchronously; an optional HMAC-SHA256 signing secret validates requests (contract: [docs/webhooks.md](docs/webhooks.md))
38
- - **WeChat personal accounts (optional external gateway)**: QR login and status polling against a local Wechaty HTTP gateway (contract: [docs/wechaty-gateway.md](docs/wechaty-gateway.md))
39
- - **Multilingual**: Chinese / English / Español, following the DSH Web UI language (Spanish browsers auto-switch); defaults to Simplified Chinese
44
+ - **Proactive send channel**: `POST /gateway/send` (`{"chatid": "...", "content": "..."}`) sends markdown messages as the bot
45
+ - **Message routing rules** (plugin config `routes`): route messages by "platform + keyword prefix" to a specific **agent preset** (isolated session) with an optional **dedicated model / skill**
46
+ - **Agent push tool** (`send_chat_message`): automatically registers a universal message-pushing tool for DSH agents, allowing AI assistants to proactively send summaries, task results, or alerts (including screenshots and text) to WeCom, Telegram, Discord, DingTalk, etc.
47
+ - **Webhook receive endpoint**: `POST /gateway/webhook/in` accepts messages from external systems, injects them into the dedicated agent session and returns the full reply synchronously; optional HMAC-SHA256 signature validation
48
+ - **Multilingual**: Chinese / English / Español, following the DSH Web UI language; defaults to Simplified Chinese
40
49
  - Light / dark theme follows the DSH Web GUI
41
50
 
42
51
  ## Usage
package/README.es.md CHANGED
@@ -2,41 +2,50 @@
2
2
 
3
3
  [中文](README.md) · [English](README.en.md)
4
4
 
5
- Un plugin de pasarela de mensajería para la GUI web de DSH: una entrada "Plataformas de mensajería" debajo del botón "Nueva sesión" abre un gestor a pantalla completa para conectores de mensajería multiplataforma — guardado de credenciales, pruebas de conexión, monitoreo de estado — más un puente persistente integrado para el bot de IA de WeCom: los mensajes externos impulsan al asistente de DSH a través de una sesión de agente dedicada, y las respuestas se transmiten token a token.
5
+ ![Vista previa de dsh-message-gateway](assets/screenshot.png)
6
+
7
+ Un plugin de pasarela de mensajería para la GUI web de DSH: una entrada "Plataformas de mensajería" debajo del botón "Nueva sesión" abre un gestor a pantalla completa para conectores de mensajería multiplataforma — guardado de credenciales, pruebas de conexión, monitoreo de estado — más un puente persistente integrado para el bot de IA de WeCom: los mensajes externos impulsan al asistente de DSH a través de una sesión de agente dedicada, y las respuestas se transmiten token a token. También proporciona una API universal de push proactivo que admite texto Markdown e imágenes nativas.
6
8
 
7
9
  ## Características
8
10
 
9
11
  - **Entrada en la barra lateral**: un botón "📮 Plataformas de mensajería" debajo de "Nueva sesión" abre el gestor a pantalla completa (cierre con ESC o haciendo clic en el fondo)
10
- - **Conectores multiplataforma**: Telegram / Discord / Bot de QQ / WeCom / Bot de IA de WeCom / WeChat (pasarela Wechaty externa) / Cuenta oficial de WeChat / WhatsApp / Email / Webhooks
11
- - **Bot de Telegram**: guarde un Bot Token para activar el sondeo largo al instante; chatee directamente con el bot (respuestas en streaming mediante envío + edición progresiva, igual que en la web)
12
- - **Bot de Discord**: guarde un Bot Token para conectarse a la pasarela (habilite la intención privilegiada MESSAGE CONTENT en el portal de desarrolladores); chatee en canales o mensajes directos
13
- - **Bot de QQ**: guarde appId + secret para conectarse a la pasarela de la plataforma abierta (canales/grupos/DM); respuestas pasivas + edición en streaming
14
- - **App de WeCom**: rellene CorpID/AgentID/Secret más el Token/EncodingAESKey de callback, configure la URL de callback (`/gateway/wecom/callback`) en la consola, y los usuarios que escriban al app reciben respuestas automáticas
15
- - **Cuenta oficial de WeChat**: rellene AppID/Secret más el Token de callback, configure la URL del servidor (`/gateway/wechat-mp/callback`) en la consola, y los seguidores que escriban reciben respuestas automáticas
16
- - **WhatsApp**: rellene Token + Phone Number ID, configure el webhook (`/gateway/whatsapp/webhook`) en la consola de Meta, y los usuarios que escriban reciben respuestas automáticas
17
- - **Email**: rellene IMAP (recepción, 993/143) + SMTP (respuesta, 465/587/25); los mensajes se agrupan en sesiones por hilo y las respuestas usan Re: asunto original
18
- - **Bot de DingTalk**: configure el Webhook y la clave secreta opcional para notificaciones de grupo
19
- - **Bot de Feishu / Lark**: configure el Webhook y la firma secreta para el envío de mensajes
20
- - **Bark (iOS)**: ingrese la Device Key para notificaciones instantáneas en dispositivos Apple
21
- - **ServerChan**: configure la SendKey para enviar notificaciones a WeChat
12
+ - **Conectores multiplataforma**: Telegram / Discord / Bot de QQ / WeCom / Bot de IA de WeCom / WeChat (pasarela Wechaty externa) / Cuenta oficial de WeChat / WhatsApp / Email / DingTalk / Feishu / Bark / ServerChan / Webhooks
13
+ - **Bot de IA de WeCom**: rellene `botId + secret` para conexión WebSocket persistente; admite respuestas en streaming, subida de medios y **envío proactivo de imágenes/archivos**
14
+ - **Bot de Telegram**: guarde un Bot Token para sondeo largo, admite streaming y `sendPhoto` para **envío proactivo de imágenes**
15
+ - **Bot de Discord**: guarde un Bot Token para conectar vía Gateway, admite canales/DMs y adjuntos `files` para **envío proactivo de imágenes**
16
+ - **Bot de DingTalk**: configure Webhook y Secret opcional; admite Markdown y URL de imagen pública
17
+ - **Bot de Feishu / Lark**: configure Webhook y Secret opcional para entrega de mensajes y tarjetas
18
+ - **Bark (iOS)**: ingrese la Device Key para notificaciones instantáneas con banners de imágenes ricas (URL pública)
19
+ - **ServerChan**: configure SendKey para notificaciones a WeChat con URLs de imágenes en Markdown
20
+ - **Bot de QQ**: guarde appId + secret para conectar a la plataforma abierta; respuestas pasivas + edición en streaming
21
+ - **App de WeCom**: rellene CorpID/AgentID/Secret más Token/EncodingAESKey de callback
22
+ - **Cuenta oficial de WeChat**: rellene AppID/Secret más Token de callback
23
+ - **WhatsApp**: rellene Token + Phone Number ID para webhooks de WhatsApp
24
+ - **Email**: rellene IMAP (993/143) + SMTP (465/587/25) para correos en hilos
25
+ - **Canal de push proactivo universal**: `POST /gateway/push` (para tareas programadas, scripts de automatización y pipelines):
26
+ - Cuerpo de la petición:
27
+ - `platform`: plataforma destino (`wecom-aibot` / `telegram` / `discord` / `dingtalk` / `feishu` / `bark` / `serverchan` / `email`)
28
+ - `target`: destino (userid o grupo para `wecom-aibot`; chatId numérico para `telegram`; channelId para `discord`; deviceKey para `bark`, etc.)
29
+ - `content`: texto opcional (admite Markdown)
30
+ - `title`: título opcional (asunto de correo o prefijo de notificación)
31
+ - `image`: imagen opcional (datos en **Base64** o URL accesible `http(s)://`)
32
+ - `filename`: nombre de archivo opcional (por defecto `image.png`)
33
+ - Destacados:
34
+ - El texto y la imagen se pueden enviar juntos o por separado
35
+ - `wecom-aibot`, `telegram` y `discord` admiten la carga directa de buffers binarios locales
36
+ - `bark`, `dingtalk` y `serverchan` se adaptan automáticamente al modo de URL pública
22
37
  - **Gestión de credenciales**: el texto plano se guarda solo en `~/.dsh/gateway.json` (modo 600, escritura atómica); `/gateway/list` nunca devuelve credenciales, solo un marcador `configured`
23
- - **Redacción de secretos**: el contenido de los mensajes escrito en registros / consola se enmascara automáticamente ante posibles secretos (claves con prefijo `sk-`, tokens de GitHub, `Bearer`, asignaciones `password=`, claves PEM privadas y otros patrones comunes), de modo que los secretos de las conversaciones del bot nunca se filtran a los archivos de registro
24
- - **Pruebas de conexión**: comprobaciones reales por plataforma — Telegram/Discord vía Bot API, QQ vía access_token, WeCom vía gettoken, cuenta oficial vía cgi-bin/token, WhatsApp vía Graph API, Email vía banner TCP de IMAP, Bot de IA de WeCom vía la conexión larga del SDK oficial (autenticado = correcto)
25
- - **Puente persistente del Bot de IA de WeCom**: conexión larga WebSocket del SDK oficial con reconexión por retroceso exponencial; los mensajes de texto entrantes se inyectan en una sesión de agente dedicada y aislada que despierta al controlador de DSH; las respuestas se transmiten como fragmentos y finalizan vía `response_url`
26
- - **Eliminación de menciones @ en grupos**: se quita el `@nombre-del-bot` inicial antes de que el asistente vea el mensaje
27
- - **Comandos de barra**: `/help` / `/time` / `/status` (alias en chino: 帮助/菜单/时间/状态)
28
- - **Mensaje de bienvenida**: configuración opcional (`welcomeReply`, por defecto `false` para cero interrupciones; al activarse en `true`, responde un saludo cuando un usuario entra al chat individual por primera vez ese día)
29
- - **Canal de envío proactivo**: `POST /gateway/send` (`{"chatid": "...", "content": "..."}`, chat individual = userid, grupo = id de grupo) envía mensajes markdown como el bot
30
- - **Push proactivo universal**: `POST /gateway/push` (`{"platform": "...", "target": "...", "content": "...", "title": "opcional"}`) envía texto a cualquier plataforma para notificaciones de tareas / otros plugins:
31
- - `platform` admite `telegram` (target = chatId numérico), `discord` (target = channelId), `wecom-aibot` (target = userid/id de grupo), `email` (target = correo, title como asunto)
32
- - QQ no admite push activo desde el 2025-04-21 (solo respuestas pasivas); devuelve un error claro
33
- - una plataforma no conectada devuelve `bridge not connected`
34
- - **Reglas de enrutado de mensajes** (configuración del plugin `routes`): enruta mensajes por "plataforma + prefijo de palabra clave" a un **preset de agente** específico (sesión aislada) con un **modelo / skill** opcional. Ej.: `{ id: "code", matchPlatform: "telegram", matchPrefix: "code ", agentPreset: "code" }` hace que `code escribe una función` en Telegram entre en una sesión de preset code. Gana la primera regla que coincida; los mensajes sin coincidencia usan el agente por defecto
35
- - **Comandos de barra**: `/help` / `/time` / `/status` / `/stats` (alias en chino: 帮助/菜单/时间/状态/统计); `/stats` muestra el estado de conexión de cada puente y el número de chats activos
36
- - **Herramienta de push para agentes** (`send_chat_message`): registra automáticamente una herramienta de envío de mensajes para los agentes de DSH, permitiendo que el asistente envíe resúmenes, resultados o alertas a Telegram, Discord, WeCom o Email directamente desde la conversación
37
- - **Endpoint de recepción de webhooks**: `POST /gateway/webhook/in` acepta mensajes de sistemas externos (cualquiera de `text` / `content` / `message`), los inyecta en la sesión de agente dedicada y devuelve la respuesta completa de forma síncrona; un secreto de firma HMAC-SHA256 opcional valida las peticiones (contrato: [docs/webhooks.md](docs/webhooks.md))
38
- - **Cuentas personales de WeChat (pasarela externa opcional)**: inicio de sesión por QR y sondeo de estado contra una pasarela HTTP Wechaty local (contrato: [docs/wechaty-gateway.md](docs/wechaty-gateway.md))
39
- - **Multilingüe**: chino / inglés / español, siguiendo el idioma de la interfaz web de DSH (los navegadores en español cambian automáticamente); por defecto chino simplificado
38
+ - **Redacción de secretos**: el contenido de los mensajes escrito en registros / consola se enmascara automáticamente ante posibles secretos
39
+ - **Pruebas de conexión**: comprobaciones reales por plataforma — Telegram/Discord vía Bot API, QQ vía access_token, WeCom vía gettoken, cuenta oficial vía cgi-bin/token, WhatsApp vía Graph API, Email vía banner TCP de IMAP, Bot de IA de WeCom vía la conexión larga del SDK oficial
40
+ - **Puente persistente del Bot de IA de WeCom**: conexión larga WebSocket del SDK oficial con reconexión por retroceso exponencial
41
+ - **Eliminación de menciones @ en grupos**
42
+ - **Comandos de barra**: `/help` / `/time` / `/status` / `/stats`
43
+ - **Mensaje de bienvenida opcional**
44
+ - **Canal de envío proactivo**: `POST /gateway/send`
45
+ - **Reglas de enrutado de mensajes** (`routes`)
46
+ - **Herramienta de push para agentes** (`send_chat_message`): registra automáticamente una herramienta para que los agentes envíen resúmenes, resultados o alertas (incluyendo imágenes y capturas de pantalla)
47
+ - **Endpoint de recepción de webhooks**: `POST /gateway/webhook/in`
48
+ - **Multilingüe**: chino / inglés / español, siguiendo el idioma de la interfaz web de DSH
40
49
  - Tema claro / oscuro siguiendo la GUI web de DSH
41
50
 
42
51
  ## Uso
package/README.md CHANGED
@@ -2,23 +2,38 @@
2
2
 
3
3
  [English](README.en.md) · [Español](README.es.md)
4
4
 
5
- DSH Web GUI 的消息平台网关插件:在侧边栏「新会话」按钮下方提供「消息平台」入口,全屏管理多平台消息连接器——凭据保存、连接测试、状态监控,并内置企业微信智能机器人的常驻桥接:外部消息经专用 agent 会话驱动 DSH 助手,回复按 token 流式回发。
5
+ ![dsh-message-gateway 功能界面](assets/screenshot.png)
6
+
7
+ DSH Web GUI 的消息平台网关插件:在侧边栏「新会话」按钮下方提供「消息平台」入口,全屏管理多平台消息连接器——凭据保存、连接测试、状态监控,并内置企业微信智能机器人的常驻桥接:外部消息经专用 agent 会话驱动 DSH 助手,回复按 token 流式回发;同时提供全平台通用主动图文推送通道(支持发送 Markdown 文本与多模态原生图片)。
6
8
 
7
9
  ## 功能
8
10
 
9
11
  - **侧边栏入口**:「新会话」按钮下方新增「📮 消息平台」按钮,点击打开全屏管理页(ESC / 点击遮罩关闭)
10
- - **多平台连接器**:Telegram / Discord / QQ 机器人 / 企业微信 / 企业微信智能机器人 / 微信(外部 Wechaty 网关)/ 微信公众号 / WhatsApp / Email / Webhooks
11
- - **Telegram 机器人**:填 Bot Token 保存即启用长轮询,与机器人对话即可使用(流式回复:发送后渐进编辑,与 Web 一致)
12
- - **Discord 机器人**:填 Bot Token 保存即接入网关(需在开发者后台开启 MESSAGE CONTENT 意图),频道/私信直接对话
12
+ - **多平台连接器**:Telegram / Discord / QQ 机器人 / 企业微信 / 企业微信智能机器人 / 微信(外部 Wechaty 网关)/ 微信公众号 / WhatsApp / Email / 钉钉 / 飞书 / Bark / Server酱 / Webhooks
13
+ - **企业微信智能机器人**:填 `botId + secret` 保存即建立官方 SDK WebSocket 常驻连接;支持文本流式对话、素材上传与**主动图片/文件推送**
14
+ - **Telegram 机器人**:填 Bot Token 保存即启用长轮询,与机器人对话即可使用,支持 `sendPhoto` **主动图片推送**
15
+ - **Discord 机器人**:填 Bot Token 保存即接入网关,频道/私信直接对话,支持 `files` 附件**主动图片推送**
16
+ - **钉钉群机器人**:配置自定义机器人 Webhook 与可选加签密钥(Secret),支持 Markdown 消息推送与公网图片 URL 渲染
17
+ - **飞书群机器人**:配置自定义机器人 Webhook 与可选签名密钥(Secret),支持标准文本与卡片推送
18
+ - **Bark (iOS)**:填入 Device Key,实现手机秒级弹窗通知推送与富文本大图横幅(公网 URL)
19
+ - **Server酱 (Turbo版)**:填入 SendKey,支持将通知推送至微信 / 手机服务号,支持 Markdown 图片 URL
13
20
  - **QQ 机器人**:填 appId + secret 保存即连接开放平台网关(频道/群/私信),被动回复 + 流式编辑
14
21
  - **企业微信应用**:填 CorpID/AgentID/Secret + 回调 Token/EncodingAESKey,后台配置回调 URL(`/gateway/wecom/callback`)后发消息即自动对话
15
22
  - **微信公众号**:填 AppID/Secret + 回调 Token,后台配置服务器 URL(`/gateway/wechat-mp/callback`)后发消息即自动对话
16
23
  - **WhatsApp**:填 Token + Phone Number ID,Meta 后台配置 Webhook(`/gateway/whatsapp/webhook`)后发消息即自动对话
17
24
  - **Email**:填 IMAP(收件,993/143)+ SMTP(回复,465/587/25),按邮件线程自动归类会话,回复用 Re: 原主题
18
- - **钉钉群机器人**:配置自定义机器人 Webhook 与可选加签密钥(Secret),支持实时推送与群消息通知
19
- - **飞书群机器人**:配置自定义机器人 Webhook 与可选签名密钥(Secret),支持标准文本与卡片推送
20
- - **Bark (iOS)**:填入 Device Key,实现手机秒级弹窗通知推送
21
- - **Server酱 (Turbo版)**:填入 SendKey,支持将通知推送至微信 / 手机服务号
25
+ - **通用主动推送通道**:`POST /gateway/push`(供定时任务、自动化脚本、外部流水线等调用):
26
+ - 请求参数:
27
+ - `platform`:目标平台(`wecom-aibot` / `telegram` / `discord` / `dingtalk` / `feishu` / `bark` / `serverchan` / `email`)
28
+ - `target`:目标会话(`wecom-aibot` 为单聊 userid 或群 ID;`telegram` 为 chatId 数字;`discord` 为 channelId;`bark` 为 deviceKey 等)
29
+ - `content`:可选文本内容(支持 Markdown)
30
+ - `title`:可选标题(Email 作为主题,其他平台作为前缀)
31
+ - `image`:可选图片数据(支持 **Base64** 编码数据,或公网可访问的 `http(s)://` 图片 URL)
32
+ - `filename`:可选图片文件名(默认 `image.png`)
33
+ - 特性:
34
+ - 文字与图片可同时发送,亦可单独发送纯文字或纯图片
35
+ - `wecom-aibot`、`telegram`、`discord` 支持本地二进制图片直接上传与原生下发
36
+ - `bark`、`dingtalk`、`serverchan` 自动适配公网图片 URL 模式
22
37
  - **凭据管理**:明文只落盘 `~/.dsh/gateway.json`(权限 600,原子写入),`/gateway/list` 永不回传凭据明文,只返回 configured 标记
23
38
  - **敏感信息脱敏**:写入日志 / 控制台的消息内容自动遮蔽疑似密钥(`sk-` 前缀、GitHub token、`Bearer`、`password=` 赋值、私钥 PEM 等通用模式),机器人对话里的机密不会泄露到日志文件
24
39
  - **连接测试**:每个平台独立的真实连接测试——Telegram/Discord 走 Bot API、QQ 走 access_token、企微走 gettoken、微信公众号走 cgi-bin/token、WhatsApp 走 Graph API、Email 走 IMAP TCP banner、企微智能机器人走官方 SDK 长连接(认证成功即通过)
@@ -27,13 +42,9 @@ DSH Web GUI 的消息平台网关插件:在侧边栏「新会话」按钮下
27
42
  - **斜杠命令**:`/help` / `/time` / `/status`(含中文别名:帮助/菜单/时间/状态)
28
43
  - **进入会话欢迎语**:可选配置(配置项 `welcomeReply`,默认 `false` 保持免打扰,开启后用户当天首次进入单聊自动回复欢迎词)
29
44
  - **主动发送通道**:`POST /gateway/send`(`{"chatid": "...", "content": "..."}`,单聊=userid,群聊=群 ID)以机器人身份主动发送 markdown 消息
30
- - **通用主动推送**:`POST /gateway/push`(`{"platform": "...", "target": "...", "content": "...", "title": "可选"}`)向任意平台目标推送文本,供定时任务通知 / 其他插件调用:
31
- - `platform` 支持:`telegram`(target=chatId 数字)、`discord`(target=channelId)、`wecom-aibot`(target=userid/群ID)、`email`(target=收件地址,title 作邮件主题)
32
- - QQ 平台官方已于 2025-04-21 取消主动推送,仅支持被动回复,调用会返回明确错误
33
- - 未连接的平台返回 `bridge not connected`
34
45
  - **消息路由规则**(插件配置 `routes`):按「平台 + 关键词前缀」把消息路由到指定 **agent 预设**(独立会话)与可选**专用模型 / skill**。例如配置 `{ id: "code", matchPlatform: "telegram", matchPrefix: "code ", agentPreset: "code" }` 后,Telegram 里发 `code 帮我写个函数` 会进入 code 预设的独立会话。按顺序匹配第一条命中;未命中走默认 agent
35
46
  - **斜杠命令**:`/help` / `/time` / `/status` / `/stats`(含中文别名:帮助/菜单/时间/状态/统计);`/stats` 展示各平台桥连接状态与活跃会话数
36
- - **Agent 主动推送工具**(`send_chat_message`):自动向 DSH 注册通用推送工具,AI 助手在对话中可自主调用该工具将总结、任务结果或告警推送至 Telegram、Discord、企业微信或 Email
47
+ - **Agent 主动推送工具**(`send_chat_message`):自动向 DSH 注册通用推送工具,AI 助手在对话中可自主调用该工具将总结、任务结果或告警(含文字与图片截图)推送至企业微信、Telegram、Discord、钉钉等平台
37
48
  - **Webhook 接收端点**:`POST /gateway/webhook/in` 接收外部系统消息(`text` / `content` / `message` 任一字段),注入专用 agent 会话并同步返回完整回复;可配置 HMAC-SHA256 签名密钥校验(契约见 [docs/webhooks.md](docs/webhooks.md))
38
49
  - **微信个人号(可选外部网关)**:对接本机 Wechaty HTTP 网关的扫码登录与状态轮询(契约见 [docs/wechaty-gateway.md](docs/wechaty-gateway.md))
39
50
  - **多语言**:中文 / English / Español,自动跟随 DSH Web 界面语言(西班牙语浏览器自动切换),默认简体中文