Skip to content
dsh.fish
Bundle

dsh-feishu-chat-viewer

飞书对话查看器:DSH Web 客户端插件,在会话头部展示与飞书 bot 的私聊记录(数据来自 OpenClaw 独立网关的 agent 会话文件,同源路由 /feishu-chat.json)。

Source
scubiry-glitch
stars
1 stars
License
MIT
Updated
Updated yesterday

Readme

# dsh-plugin-feishu-chat

**飞书对话查看器** — 一个给 [DeepSeek Harness Web](https://github.com/deepseek-ai/deepseek-harness)(dsh web)用的客户端插件:

在会话头部操作区增加一个 **💬 飞书** 按钮,点击弹出面板,**实时展示你与飞书 bot 的私聊记录**(每 5 秒自动刷新,按钮带消息数角标)。

## 它解决什么问题

当你的飞书 bot 由**独立的 OpenClaw 网关**(`openclaw gateway --profile dsh`)服务时,你与 bot 的对话记录只存在于网关的 agent 会话文件里,Web GUI 看不到。这个插件把那些记录**镜像到 dsh web 页面**上:

```
飞书 ←长连接→ OpenClaw 独立网关 (agent dsh)
                  │ 对话写入
                  ▼
        agent 会话文件 sessions/*.jsonl
                  │ 读取(node 半身,同源路由)
                  ▼
    dsh web  ──/feishu-chat.json──▶ 浏览器面板(客户端插件)
```

- **插件本体跑在 dsh web 里**(node 半身在 web 进程内注册 `/feishu-chat.json` 路由;浏览器半身渲染面板),**不依赖 OpenClaw 网关进程存活**——只要会话文件在,历史记录就能看。
- 同源路由意味着:无论页面通过 `127.0.0.1:3080`、局域网还是 Cloudflare 隧道访问,都不会有跨源/CSP 问题。

## 安装

### 方式一:一键脚本(本机安装)

```bash
git clone https://github.com/scubiry-glitch/dsh-plugin-feishu-chat.git
cd dsh-plugin-feishu-chat
./install.sh            # 安装到 /root/.dsh/profiles/ 并写入 cordis.patch.yml
pm2 restart dsh-web     # 重启后刷新页面
```

### 方式二:手动

```bash
# 1. 把包放进 web profile 的 node_modules(真实目录,勿放 npx 缓存目录!)
mkdir -p /root/.dsh/profiles/node_modules/dsh-feishu-chat-viewer/lib
cp -r lib package.json /root/.dsh/profiles/node_modules/dsh-feishu-chat-viewer/

# 2. 在 /root/.dsh/profiles/web/cordis.patch.yml 追加:
# - insert:
#     - id: feishu-chat-viewer
#       name: 'dsh-feishu-chat-viewer'

# 3. 重启
pm2 restart dsh-web
```

## 配置

| 项 | 位置 | 默认值 |
|---|---|---|
| 会话目录 `SESS_DIR` | `lib/index.js` 顶部常量 | `/root/.openclaw-dsh/agents/dsh/sessions` |
| 刷新间隔 | `lib/client.js` | 面板 5s / 角标 30s |
| 展示条数 `MAX_MSGS` | `lib/index.js` | 100 |

如果你的独立网关用了别的 profile 名,改 `SESS_DIR` 即可。

## 故障排查

| 症状 | 原因 | 处理 |
|---|---|---|
| 插件按钮不出现 | 页面缓存了旧 bundle | 强刷(Cmd/Ctrl+Shift+R);确认 `window.__DSH_BOOT__` 里有插件 id |
| 面板显示 `Failed to fetch` | 用了跨源地址(如硬编码 `127.0.0.1:18791`) | 必须用同源 `/feishu-chat.json`(本插件 node 半身提供) |
| 启动崩溃 `ERR_PACKAGE_PATH_NOT_EXPORTED` | `package.json` 的 `exports` 缺 `.` 入口 | 保留 `".": "./lib/index.js"`(node 半身) |
| 包被"凭空删除" | 包放在了 npm/npx 缓存目录,被 GC 清理 | 放到 `/root/.dsh/profiles/node_modules/`(profile 自有目录) |
| 按钮渲染为空 | 手写 bundle 把 children 传给 `jsx()` 当 key | 用 `react.createElement`(children 即多余参数) |

## 与 OpenClaw 网关模型配置的关系

面板**完全不受网关模型配置影响**:模型不可用时只是飞书 bot 不再产生新回复,历史对话照常展示;网关进程崩溃也不影响已落盘的会话文件。

## 许可

MIT

Install

dsh plugin --profile web add github:scubiry-glitch/dsh-plugin-feishu-chat#8b6656f9bc64b6f533fab057426b765d68954ae2

Profile: web

Source