shrekcg/dsh-im-channel

shrekcg/dsh-im-channel

DeepSeek Harness 的统一 IM 渠道:飞书、Telegram、钉钉、Slack、Discord —— 持久会话、真流式回复、40 个飞书 MCP 工具、斜杠命令,以及插件设置页中的 IM 机器人状态页。

通知与集成

DSH ↔ IM Channel

A unified IM channel connecting DeepSeek Harness to Feishu, DingTalk, Telegram, Slack, Discord, QQ and more


Introduction

DSH ↔ IM Channel is a unified multi-channel plugin that connects DeepSeek Harness (DSH, an AI agent runtime) to multiple IM platforms (Feishu, DingTalk, Telegram, Slack, Discord, QQ...). It gives your AI assistant a "first-class app" experience inside Feishu:

  • 💬 Persistent conversations: cross-message context memory, topic isolation, group & DM chat
  • ⌨️ True streaming output: token-by-token display with a smooth typewriter effect
  • 🛠️ 40 Feishu object tools: the agent can operate docs, sheets, calendar, tasks, mail, and more
  • 🧩 Pluggable plugin form: no changes to the DSH core; one-click install / uninstall

Aligned with the capabilities of the OpenClaw Feishu plugin, but built on the DSH ecosystem.


✨ Features

🌐 Supported Channels

⚠️ Honest status: Feishu and Telegram are fully stable (bidirectional). DingTalk/Slack/Discord are experimental/partial (see below). QQ/WeChat/WhatsApp adapters are not provided in this version.

ChannelStatusSetup
Feishu 📘✅ Full (primary)WebSocket long-connection (Open Platform)
Telegram ✈️✅ FullBotFather in-chat (easiest)
Slack 🟣🟡 Partial (receive needs @slack/socket-mode)Socket Mode
Discord 🎮🟡 Partial (receive needs discord.js)Gateway (bot token)
DingTalk 📱🟡 Experimental (Stream not fully implemented)Needs @alicloud/dingtalk-stream

Send /channels in Feishu to see all channels and setup steps, or /channels add <channel> for a guide.

💬 Conversation

FeatureDescription
Persistent sessionsCross-message memory (DSH agents.resume)
Topic isolationEach thread gets an independent context (fork from mainline)
Group chatResponds without @, or per-group fine-grained policies (allowlist / mention-only)
Thinking reactionTHINKING shown on receive, auto-removed after reply
True streamingToken-by-token display with adaptive typewriter pacing
Elapsed footerSmall "Completed · X.Xs" footer at the bottom, aligned with OpenClaw
@ user renderingNative mentions of users / @all in replies
Bot-to-bot @Configurable bot-to-bot conversations

📎 Messaging

FeatureDescription
Media send/receiveImage / file / audio / video download & send
Merge-forwardRecognizes and expands merged-forward messages
Reaction feedback👍/❤️ reactions fed back to the agent
Doc-comment @@ the bot in doc comments to trigger a conversation

🛠️ Feishu Object Tools (MCP × 40)

Exposes 40 Feishu tools via Model Context Protocol, callable natively as mcp__feishu__*:

CategoryTools
Messagingsend_message read_messages search_chats get_chat_members search_messages read_thread_messages
Docsread_document create_document update_document doc_insert_media doc_list_comments
Calendarcalendar_agenda create_calendar_event calendar_freebusy calendar_search_events calendar_add_attendee
Tasksget_my_tasks create_task task_create_subtask task_get_detail task_related task_add_comment
Base (Bitable)base_read_records base_create_table base_create_record base_create_field base_create_view
Sheetssheets_read
Wikiwiki_search wiki_list_spaces wiki_create_node
Mailmail_list mail_send
Drivedrive_search drive_list_folder
Minutes / Approval / Searchminutes_search approval_list_todo search_docs
Contactsget_user_info

🧩 Platform

FeatureDescription
Multi-account / multi-botOne process manages multiple bots with isolated sessions
Pluggable pluginOne-click install / uninstall, no DSH core changes
Setup wizardnpm run setup — 6-step guided init (app / permissions / auth / events)
Diagnostics & self-repairnpm run doctor — 21 checks + --fix auto-repair
Feature checklistnpm run features — see each capability's config status
Permission managementAuto-detects missing scopes, generates one-click apply links
CIGitHub Actions: unit tests + MCP smoke verification
Channel status pageBuilt-in HTTP status page — see Feishu online/account/health in real time (http://127.0.0.1:8899)
IM bot settings tabAn IM Bots tab inside DSH settings → Plugins, showing channel status (web-plugin/)
Slash commandsUse /new /compact /model /status etc. directly in Feishu chat

⌨️ Slash Commands

Type commands directly in Feishu chat (instant response, no AI call consumed):

CommandDescription
/helpList all available commands
/new / /clearStart a new conversation (clear current session context)
/compactCompact the current session (reduce context)
/model [name]View / switch model (e.g. /model deepseek-v4-flash)
/status / /stateView current status (model / session / tools / uptime)
/toolsList available Feishu tools (40)
/featuresView the feature checklist
/doctorRun diagnostics

📦 Quick Start

Prerequisites

DependencyDescription
DSHDeepSeek Harness runtime
lark-cliOfficial Feishu CLI (tool execution backend)
Node.js ≥ 18Runtime

Install

# 1. Clone
git clone https://github.com/shrekcg/dsh-im-channel.git
cd dsh-im-channel

# 2. Install dependencies
npm install

# 3. Setup wizard (app creation / auth / event subscription, step by step)
npm run setup

# 4. Install as plugin + launchd service
npm run install-bridge

# 5. Verify
npm run doctor        # diagnostics (21 checks)
npm run features      # feature checklist

See docs/SETUP.md and docs/INSTALL.md for details.


🔧 Configuration

Configure via environment variables or config.json (see config.example.json):

VariableDefaultDescription
LARK_APP_ID—Feishu app ID
LARK_APP_SECRET—Feishu app secret
REQUIRE_MENTIONfalseWhether group chat requires @ to respond
ALLOW_BOTSfalseBot-to-bot @: false / true / mentions
GROUP_POLICYopenGroup policy: open / allowlist / closed
GROUP_ALLOW_FROM—Group allowlist (comma-separated open_ids)
REACTION_NOTIFICATIONSoffReaction feedback: off / own / all
STREAM_THROTTLE_MS60Streaming throttle time threshold (ms)
STREAM_THROTTLE_CHARS3Streaming throttle char threshold
ALLOW_USER_WRITES—Allow user-identity writes (default: only messaging uses bot)
DSH_BIN / DSH_HOME—DSH paths

🚀 Usage

Chat

  • DM: message the bot directly in Feishu
  • Group: add the bot to a group, then chat (with or without @, depending on config)
  • Thread: create a thread on a group message for an isolated context

Feishu Tools

Just ask in natural language:

  • "What's on my calendar today?"
  • "Create a doc with the content ..."
  • "Send a message to XX"
  • "List my to-do tasks"

Management Commands

npm start                # start the bridge
# Status page: open http://127.0.0.1:8899 (Feishu online status / account / health)
npm run setup            # setup wizard
npm run doctor           # diagnostics (--fix auto-repair)
npm run features         # feature checklist
npm test                 # run tests (65 cases)
npm run install-bridge   # install plugin + launchd service
npm run uninstall-bridge # uninstall (reversible, no DSH core impact)
npm run mcp              # run MCP server standalone

🏗️ Architecture

┌──────────────────────────────────────────────────┐
│                     Feishu / Lark                 │
│   DM · Group · Thread · Reaction · Comment · Card │
└───────────────────────┬──────────────────────────┘
                        │ WebSocket long-connection (SDK)
┌───────────────────────▼──────────────────────────┐
│               bridge (daemon process)            │
│  ┌─────────┐ ┌────────────┐ ┌─────────────────┐  │
│  │ channel │ │  inbound   │ │    outbound     │  │
│  │ (SDK)   │ │ policy     │ │ stream (true)   │  │
│  │         │ │ media      │ │ mention (@)     │  │
│  │         │ │ reaction   │ │ footer (elapsed)│  │
│  │         │ │ merge-fw   │ │                 │  │
│  └────┬────┘ └─────┬──────┘ └────────┬────────┘  │
│       └────────────┼─────────────────┘           │
└────────────────────┼─────────────────────────────┘
                     │ DSH headless (persistent session)
              ┌──────▼──────┐
              │  agents.resume│
              │  + MCP client │
              └──────┬──────┘
                     │ mcp__feishu__* (40 tools)
              ┌──────▼──────┐
              │ Feishu MCP  │
              │ server      │
              └──────┬──────┘
                     │ lark-cli
              ┌──────▼──────┐
              │  Feishu OpenAPI│
              └─────────────┘
  • Receive: @larksuite/channel SDK WebSocket long-connection (no public callback URL needed)
  • Session: fixed session + DSH agents.resume (cross-message memory)
  • Tools: 40 MCP tools with lark-cli execution backend

See docs/ARCHITECTURE.md for details.


📁 Project Structure

dsh-im-channel/
├── src/
│   ├── index.js              # entry (multi-account message pipeline)
│   ├── config.js             # configuration
│   ├── channel.js            # Feishu channel (SDK + streaming)
│   ├── session.js            # persistent sessions + mutex lock
│   ├── core/
│   │   ├── scope-manager.js  # permission management
│   │   ├── adaptive.js       # adaptive streaming step
│   │   └── pacing.js         # streaming pacing control
│   ├── inbound/
│   │   ├── policy.js         # group policy / bot / @
│   │   ├── media.js          # media receive
│   │   ├── reaction.js       # reaction feedback
│   │   ├── merge-forward.js  # merge-forward
│   │   └── comment.js        # doc-comment @
│   ├── outbound/
│   │   └── mention.js        # @ rendering
│   ├── tools/
│   │   └── mcp-server.js     # Feishu MCP server (40 tools)
│   └── commands/
│       ├── doctor.js         # diagnostics & self-repair (21 checks)
│       └── features.js       # feature checklist
├── dsh-lark-session/         # DSH plugin (persistent-session runner)
├── scripts/
│   ├── install.js            # install / uninstall / status
│   └── setup.js              # setup wizard
├── tests/                    # 65 unit tests
└── docs/                     # documentation

📚 Documentation

DocDescription
SETUP.mdDetailed setup guide
INSTALL.mdPlugin install guide
ARCHITECTURE.mdArchitecture design
README.md中文 README

🧪 Testing

npm test    # 65 unit tests

CI (GitHub Actions) automatically runs: unit tests + syntax checks + MCP server smoke verification.


📄 License

MIT

🙏 Credits