Prelude¶
In the DeepSeek Harness (DSH) ecosystem, agents typically need to interact with users through instant messaging (IM) platforms. If adaptation logic is developed separately for each platform (such as Feishu, Telegram, and Discord), it leads to a large amount of code duplication. The dsh-messaging plugin aims to solve this problem by providing a unified set of interfaces, allowing developers to configure it once and switch between Feishu, Telegram, Discord, and WeCom.
Core Capabilities¶
This plugin is designed based on a plugin architecture and has the following core capabilities:
- MessagePlatform abstraction: Provides a unified platform abstraction layer that shields underlying protocol differences.
- Plugin architecture: Uses the adapter pattern, with each platform integrated as an independent adapter.
- Capability degradation: When a platform does not support a specific feature, fallback handling is automatically triggered and the user is informed.
- Markdown auto-downgrade: For platforms that do not support Markdown rendering (such as Feishu), Markdown is automatically converted to plain text.
- Production-hardened: Includes production environment features such as message deduplication, per-chat serialization, and automatic Token refresh.
- CapabilitySet: Allows agents to query the current platform’s capability list before execution.
- Streaming buffer: Buffers streaming output text and sends it after the reply is complete to avoid incomplete messages.
- Retry with backoff: Includes a built-in retry mechanism with exponential backoff support, and handles rate-limit responses from Telegram and Feishu.
- Per-chat serialization: Ensures that messages within the same conversation are processed in order.
- Message dedup: Filters duplicate events from platforms such as Feishu using TTL and limit mechanisms.
Installation and Enablement¶
Installing the plugin requires using DSH’s plugin command. The plugin is maintained by andiven and follows the MIT license.
dsh plugin --profile web add github:andiven/dsh-messaging
After installation, the plugin needs to be enabled in the configuration file. The plugin is injected into the DSH instance via cordis.patch.yml.
Typical Usage¶
Configuration example (using Feishu as an example):
# cordis.patch.yml
- id: messaging
name: '@dsh-messaging/messaging'
config:
platform: feishu
feishu:
appId: env:FEISHU_APP_ID
appSecret: env:FEISHU_APP_SECRET
mode: websocket
autoConnect: true
Platform Configuration Requirements¶
Different platforms require different credentials and permissions:
- Feishu: You need to create a custom app on the Open Platform, enable the
im:messagepermission, subscribe to theim.message.receive_v1long connection, and publish the app. - Telegram: Create a bot through @BotFather and obtain the Token.
- Discord: Create an application in the Developer Portal and add a Bot, enable the “Message Content” permission intent, invite it to a server using the
botscope, and obtain the Token. - WeCom: Create a custom app in the admin console and record the Corp ID, Secret, and AgentId. Inbound messages require registering an HTTP callback URL in the console (the callback configuration can be omitted if only sending messages is needed).
Applicable Scenarios and Notes¶
This plugin is suitable for agent projects that need to integrate multiple IM platforms within a single DSH instance.
Known limitations:
* Feishu media sending: Sending images, audio, videos, and files is not yet implemented.
* Card message degradation: Telegram and WeCom card messages are downgraded to formatted text; Discord card messages are downgraded to Embeds.
* Reconnection mechanism: Discord gateway reconnection is best-effort; connections closed in a non-recoverable state are re-established; there is no reconnection state retention, so restarts may cause updates in the queue to be lost.
* Single instance, single platform: Each DSH instance currently supports configuring only one platform.
* No test coverage: The project currently has no test suite.
Brief Conclusion¶
dsh-messaging reduces the complexity of multi-platform IM integration through a unified interface and automatic degradation mechanisms. Developers can visit GitHub to view the source code or submit an Issue.