dsh-feishu-bridge
消息通讯 活跃维护

dsh-feishu-bridge

pwangxo-sg/dsh-feishu-bridge

实现飞书侧与AI助手的完整双向对接,支持会话消息实时同步,同时原生适配飞书审批能力,部署配置轻量,可快速实现用户无感知交互,审批流程自动触发流转。

1
Stars 标星
0
Forks 分支
1
Watchers 关注
0
Open Issues
JavaScript
主要语言
MIT
开源协议
21 KB
仓库大小
1 个月前
最后推送
一键安装扩展 / 插件指令
dsh plugin --profile web add github:pwangxo-sg/dsh-feishu-bridge
git clone https://github.com/pwangxo-sg/dsh-feishu-bridge.git
git clone git@github.com:pwangxo-sg/dsh-feishu-bridge.git
README.md main

dsh-feishu-bridge

飞书 / Lark ↔ DeepSeek Harness 完整通道 | Full Feishu/Lark channel for DeepSeek Harness

把飞书与 DeepSeek Harness 打通(无需公网地址):
Bridge Feishu/Lark with DeepSeek Harness (no public address needed).

  • 飞书通道:WebSocket 长连接收发(单聊 + 群聊 @机器人),消息进 DSH agent,回复推回飞书,与 Web 会话双向同步。
  • Feishu channel: WebSocket long-connection (1:1 + group @), messages forwarded to the DSH agent, replies mirrored back to Feishu, two-way sync with the Web session.
  • 飞书审批:DSH 审批请求推送到飞书,回复「同意 / 拒绝」即可控制 agent 权限。
  • Feishu approval: DSH approval requests are pushed to Feishu; reply "同意 / 拒绝" (approve / reject) to control agent permissions.
  • 零个人硬编码:凭据走 .secrets.env(已 gitignore)。
  • Zero personal hardcoding: credentials via .secrets.env (gitignored).

快速开始 / Quick Start

前置:已安装并运行 DeepSeek Harness(dsh web,默认 http://127.0.0.1:3080)。
Prerequisite: DeepSeek Harness running (dsh web, default http://127.0.0.1:3080).

git clone <repo-url> dsh-feishu-bridge
cd dsh-feishu-bridge

# 1) 填飞书凭据 / fill in Feishu credentials
cp .secrets.env.example .secrets.env
# 编辑 .secrets.env:FEISHU_APP_ID / FEISHU_APP_SECRET(FEISHU_DOMAIN=feishu 或 lark)

# 2) 安装依赖 / install dependencies
npm install --no-audit --no-fund

# 3) 前台运行(测试)/ run in foreground (test)
node bridge.mjs
# 看到 "WebSocket 已连接" 即成功 / connected → send a message to the bot in Feishu

# 4)(可选)注册为 launchd 常驻 / (optional) register as launchd service
bash daemon/install.sh

飞书应用要求 / Feishu App Requirements

飞书开放平台创建自建应用 / Create a custom app at Feishu Open Platform:

  1. 启用「机器人」能力 / Enable "Bot" capability.
  2. 事件接收方式选「长连接」/ Choose "Long connection" for event subscription, 订阅 im.message.receive_v1.
  3. 权限 / Permissions: im:message.p2p_msg:readonly / im:message.group_at_msg:readonly / im:message:send_as_bot.
  4. 发布版本并安装到企业 / Publish a version and install to your tenant.

详细步骤见 / See docs/feishu-app-setup.md.


配置(.secrets.env)/ Configuration

变量 / Var 说明 / Description
FEISHU_APP_ID 飞书应用 App ID
FEISHU_APP_SECRET 飞书应用 App Secret(不入库 / not committed)
FEISHU_DOMAIN feishu(国内 / CN)/ lark(国际 / intl),默认 feishu
FEISHU_REQUIRE_MENTION 群聊是否必须 @机器人 / require @mention in groups,默认 true
SESSION_MODE single(所有消息一会话 / one session for all)/ per-chat(每聊天一会话 / one per chat),默认 single
TARGET_SESSION_ID single 模式驱动指定会话 / drive a specific session;不设则用固定会话 session-feishu-bridge
DSH_WEB_URL DSH 地址 / DSH URL,默认 http://127.0.0.1:3080

审批 / Approvals

  • agent 需要权限时(写工作区外等),审批请求自动推送到你最近对话的飞书聊天。
  • When the agent needs permissions (e.g. writing outside the workspace), the approval request is pushed to your recent Feishu chat.
  • 回复「同意」放行 / 回复「拒绝」拦截。
  • Reply "同意" (approve) to allow, or "拒绝" (reject) to block.

管理 / Management

launchctl list | grep feishu-bridge      # 状态 / status
tail -f daemon/bridge.log                # 日志 / logs
bash daemon/uninstall.sh                 # 卸载常驻 / uninstall service

相关项目 / Related Projects

  • financial-market-analysis — 金融市场分析技能(DSH)/ Financial market analysis skill for DSH:A股/基金/QDII/黄金/亚太指数日报、指标追踪、决策追踪,可与本桥配合(飞书收报告)。

定制与支持 / Customization & Support

需要针对你的场景定制(接入更多渠道、定时报告、私有数据源)/ Need customization (more channels, scheduled reports, private data sources)? 联系 / Contact:
p.wangxo@gmail.com(标题带 [定制] 前缀 / prefix "[定制]" in subject)

License

MIT