Back to home

Qing45

dsh-feishu-chat

Feishu (Lark) bot bridge for DeepSeek Harness: two-way chat with your agent, settings page for bot credentials and workspace routing. · 飞书机器人 ↔ DSH 双向聊天桥

Stars
0
Language
JavaScript
Created
Aug 16, 2026
Updated
Aug 16, 2026

Introduction

dsh-feishu-chat

Feishu (Lark) bot bridge for DeepSeek Harness: send a message to your Feishu bot and your DSH agent answers; the agent can also push messages back to Feishu.

中文说明

Features

  • Two-way chat — Feishu messages arrive over the official WebSocket long connection (im.message.receive_v1) and are delegated to a subagent of the bound workspace's latest session; the text reply is sent back to the same chat automatically.
  • Settings page (设置 → 飞书) — configure the bot's App ID / App Secret (persisted to $DSH_HOME/feishu-bot/config.json, never sent anywhere) and pick which workspace inbound messages are routed to, all from the web UI.
  • Agent → Feishu tool — the model gets a feishu_send_message tool, so any session can push a message to the last chat that contacted DSH (or a given chat_id).
  • Robust long connection — protobuf frame decode (pbbp2), automatic ack, ping keep-alive, fragment merging (sum/seq), and reconnect with backoff, all in-process; stopping or updating the plugin tears everything down cleanly.

Install

# from npm (once published) or from this repo:
dsh plugin --profile web add dsh-feishu-chat
# or directly from GitHub:
dsh plugin --profile web add github:<your-name>/dsh-feishu-chat

Then restart dsh web and open 设置 → 飞书:

  1. Enter the bot's App ID and App Secret (Feishu Open Platform → your app → 凭证与基础信息), click 保存并重新连接.
  2. Pick the workspace that inbound Feishu messages should be routed to.

⚠️ This plugin is community third-party code — installing it runs it with your own permissions. Check the source before installing. Credentials stay local in $DSH_HOME/feishu-bot/config.json and are never committed or uploaded.

How it works

PieceFileRole
Host entrylib/index.jsCordis plugin (export const name + export function apply), wires config, router, WS client, tool and HTTP routes
Feishu APIlib/feishu.jsnode:https helpers: tenant token, send message, WS endpoint
WS clientlib/ws.jsin-process long connection: protobuf pbbp2.Frame, auto-ack, ping, fragment merge, reconnect
Routerlib/router.jsinbound message → resolve parent agent (initiator → live agent → resume) → subagent → reply
Configlib/config.js$DSH_HOME/feishu-bot/config.json persistence
Routeslib/routes.jsHTTP routes for the settings UI (same-origin writes only)
Clientclient/client.jswindow.__ModuleLoader__.load bundle registering the 设置 → 飞书 section

The package is a standard DSH bundle: package.json declares dsh.bundle.patch (layer insertion) and dsh.client (web bundle), and cordis.patch.yml inserts the plugin row into the profile tree.

Development / local install without a GUI restart

The profile's own patch layer ($DSH_HOME/profiles/<profile>/cordis.patch.yml) is hot-reloaded:

pnpm --dir "$DSH_HOME/profiles/web" add /path/to/dsh-feishu-chat

Then append to cordis.patch.yml:

- insert:
    - id: feishu-bot
      name: 'dsh-feishu-chat'

Refresh the browser — the settings section appears without restarting the harness.

Caveats

  • One subagent is spawned per inbound message (no queueing); replies may arrive out of order under a burst.
  • The TLS verification is relaxed (rejectUnauthorized: false) so the long connection works behind corporate MITM proxies / broken certificate stores; review this trade-off for your environment.
  • The tool name is feishu_send_message; chat_id defaults to the most recent chat that contacted DSH.

License

MIT