@zyfgood/dsh-feishu-bot

remotenpmMIT

Binds a Feishu/Lark bot to DeepSeek Harness over a WebSocket long connection: incoming messages run through an agent session and stream back to the chat, chat commands such as /attach manage the live session, and feishu_* tools let the model push messages.

下载量 / Downloads
579

Install

dsh plugin --profile web add @zyfgood/dsh-feishu-bot

Sandbox test

This plugin has not been tested yet. Submit a test →

README

@zyfgood/dsh-feishu-bot

npm 包名:@zyfgood/dsh-feishu-bot(配置里插件行的 name: 也必须写这个名字)。
仓库目录名 / 历史文档里的 dsh-feishu-bot 指同一个插件。

DeepSeek Harness(DSH)插件:绑定飞书(Feishu / Lark)机器人并互动。

  • 绑定:配置飞书自建应用的 appId / appSecret,通过官方 SDK

@larksuiteoapi/node-sdk

的 WebSocket 长连接接入(无需公网回调地址),SDK 内置自动重连。

  • 互动(入站):用户给机器人发消息 → 机器人自动回复,三种模式:
  • echo:回显原文(快速验证绑定是否打通);
  • llm:调用 DSH 的 ctx.llm 服务直接生成回复(自包含,带每会话短期记忆);
  • agent:把消息转交给 DSH agent 处理——指定 agentId 复用该会话,或自动为

每个飞书会话创建一个专属 agent(标准模式 preset、持续复用上下文、

具备全部 DSH 工具),agent 输出流式实时转发到飞书。

  • 任务执行中提问:agent 正在跑任务时发消息,会用 steer 在下一个节点

插入你的问题,agent 先回应(流式实时到达)再继续任务。

  • 互动(出站):注册 9 个模型可调用的 feishu_* 工具,让 DSH agent 主动

与飞书互动(发消息、回复消息、发交互卡片、确认问答、查会话、查消息、

查连接状态、推送目标群)。

  • 确认问答:agent 调用 ask_user_question / feishu_ask_choice 需要你拍板时,

问题以带按钮的交互卡片发到飞书(点按钮 / 回编号 / 回选项文字均可),

回答后卡片定格为结果视图,agent 继续流式输出。

  • 策略:群聊 @机器人 才回复、私聊开关、会话白名单、@所有人 响应开关,均由

SDK 的入站策略管道执行。


English Summary

@zyfgood/dsh-feishu-bot bridges a Feishu / Lark bot into

DeepSeek Harness (DSH). Talk to your DSH agent from Feishu on your phone — no

public callback URL needed (official WebSocket long connection, auto-reconnect).

Features

  • Inbound (user → agent): three reply modes — echo (verify binding),

llm (direct model reply with per-chat short-term memory), agent (hand the

message to a DSH agent; auto-creates a dedicated per-chat session with the

standard preset and full DSH tooling, replies streamed live to Feishu).

  • Ask while a task is running: messages sent mid-task are injected via

steer at the next step boundary — the agent answers first (streamed), then

continues the task.

  • Session commands: /new (fresh context, reply previews the next

session's model/effort/permission/preset/workspace), /model (view or switch this

chat's model — /model list numbers each model so you can switch with

/model <n> just like /attach <n>; effective from the next step on the

live session, persisted per chat), /thinking (view or switch this chat's

reasoning effort — /thinking list numbers the model's supported levels,

/thinking <level|n> switches, /thinking reset follows the default;

effective from the next step, persisted per chat), /sessions (list

sessions), /attach (take over an existing GUI session — both sides share

context), /detach.

  • Outbound (agent → Feishu): nine model-callable tools

(feishu_send_message, feishu_send_card, feishu_ask_choice,

feishu_reply_message, feishu_list_chats, feishu_get_messages,

feishu_get_chat_info, feishu_connection_status, feishu_push).

  • Interactive confirmation: when the agent needs a decision

(ask_user_question / feishu_ask_choice), a button card is sent to the

chat — click, or reply with the option number/text. After answering (or on

timeout) the card freezes into a result view, and the agent's continuation

streams into a fresh typewriter card.

  • Policies: group chats reply only when mentioned, DM on/off, chat

allowlists, respond-to-@all switch — all via the SDK inbound policy pipeline.

  • Config: appId/appSecret via env:VAR (never plaintext), domain

feishu/lark, dmMode open/allowlist/pair/disabled, group allowlist,

requireMention, agent preset & workspace, command toggles.

Install

# Git channel (repo root is the plugin)
dsh plugin --profile web add "github:zyfgood/dsh-feishu-bot#main&path:/"
# npm channel (published package)
dsh plugin --profile web add @zyfgood/dsh-feishu-bot

Then create a self-built Feishu app (see the Chinese sections below for the

open-platform steps: bot capability, im:message scopes, subscribe

im.message.receive_v1, long-connection mode, publish a version) and restart

dsh web. Log line feishu: 长连接已就绪(机器人:<bot name>) means the

binding succeeded.

License: MIT.


目录

  • [快速开始](#快速开始)
  • [一、飞书开放平台:创建并配置机器人](#一飞书开放平台创建并配置机器人)
  • [二、安装插件并加载](#二安装插件并加载)
  • [三、配置项](#三配置项)
  • [四、互动方式](#四互动方式)
  • [五、常见问题](#五常见问题)

快速开始

1. 按[第一节](#一飞书开放平台创建并配置机器人)在飞书开放平台创建自建应用并发布版本;

2. 把插件装入 profile 并配置(见[第二节](#二安装插件并加载),示例见 cordis.patch.example.yml);

3. 重启 dsh web。

日志出现 feishu: 长连接已就绪(机器人:<你的机器人名>) 即绑定成功;在飞书里

给机器人发消息即可指挥 agent 工作(群聊需 @机器人,私聊直接发),让 DSH agent 调用

feishu_connection_status 可随时查看连接状态。

飞书开放平台侧有一个关键开关:事件与回调 → 订阅方式 = 「使用长连接接收事件/回调」
(长连接模式无需配置请求地址)。若当前是回调 URL 模式,请切换为长连接,否则消息事件不会推过来。

一、飞书开放平台:创建并配置机器人

以下步骤在 飞书开放平台(国际版 Lark)

开发者后台完成,全程无需服务器公网地址。

1. 创建企业自建应用

「开发者后台」→「创建企业自建应用」,填写名称等信息。

2. 获取凭证

「凭证与基础信息」→ 复制 App ID(cli_xxx)与 App Secret。

3. 开启机器人能力

「添加应用能力」→ 勾选 机器人。

4. 添加权限(「权限管理」→ 开通以下权限,保存后需发布版本生效):

权限 · 用途

im:message:send_as_bot · 以机器人身份发送/回复消息

im:message(含 p2p_msg / group_msg / group_at_msg 子权限) · 接收用户消息事件

im:chat:readonly(可选) · 查询会话详情/列表

5. 订阅事件(「事件与回调」→「事件配置」→「添加事件」):

添加 接收消息 im.message.receive_v1。

> 使用长连接时不需要配置回调请求地址(Request URL 留空即可),

> 事件会通过 WebSocket 长连接直接推给插件。

6. 发布版本(「版本管理与发布」→ 创建版本 → 申请发布/审核通过)。

自建应用只有发布后才能被用户搜到并使用。

二、安装插件并加载

插件以 Cordis 插件形式加载,通过 profile 的 cordis.patch.yml 插入配置行。

从 Git 仓库安装(推荐,一条命令安装并挂载)
```bash
# 安装前设置密钥环境变量(也可装后再设,重启前配置好即可)
export FEISHU_APP_ID=cli_xxx
export FEISHU_APP_SECRET=xxx
dsh plugin --profile web add "github:zyfgood/dsh-feishu-bot#main&path:/"
# 或 npm 渠道(npm 上已发布):
# dsh plugin --profile web add @zyfgood/dsh-feishu-bot
```
包内自带 cordis.patch.yml(dsh.bundle.patch),CLI 安装时自动挂载,
无需手工编辑配置文件;默认 llm 模式,改 agent 模式等见「三、配置项」,
在 profile 自己的 cordis.patch.yml 里按 `id: feishu-

…(truncated)

Rendered from the README published on npm. Formatted only, not edited.

Versions

Published on npm::4,最后更新 2026-10-19

Links

GitHub · Homepage · npm

Same category